Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add BigInteger to ToBencodexValue() #159

Merged

Conversation

earlbread
Copy link
Contributor

  • Added BigInteger to ToBencodexValue.

@earlbread earlbread self-assigned this Mar 28, 2019
@@ -115,6 +122,7 @@ protected Person(SerializationInfo info, StreamingContext context)
.ToList();
Secret = info.GetString("Secret");
IsStudent = info.GetBoolean("IsStudent");
Assets = (BigInteger)info.GetValue("Assets", typeof(BigInteger));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have GetValue<T>(), so you can use it.

dahlia
dahlia previously approved these changes Mar 28, 2019
@codecov
Copy link

codecov bot commented Mar 28, 2019

Codecov Report

Merging #159 into master will decrease coverage by 2.9%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master     #159      +/-   ##
==========================================
- Coverage   87.06%   84.16%   -2.91%     
==========================================
  Files          69       69              
  Lines        3163     3164       +1     
==========================================
- Hits         2754     2663      -91     
- Misses        409      501      +92
Impacted Files Coverage Δ
Libplanet/Serialization/BencodexFormatter.cs 81.91% <100%> (+0.19%) ⬆️
Libplanet/Net/IceServer.cs 0% <0%> (-100%) ⬇️
Libplanet/Net/IceServerException.cs 0% <0%> (-100%) ⬇️
Libplanet/Net/NetworkStreamProxy.cs 0% <0%> (-80.77%) ⬇️
Libplanet/Net/Swarm.cs 83.75% <0%> (-4.66%) ⬇️

@earlbread
Copy link
Contributor Author

I added a commit. Please take a look. @dahlia @longfin

@@ -109,12 +116,12 @@ protected Person(SerializationInfo info, StreamingContext context)
{
Name = info.GetString("Name");
Age = (int)info.GetInt64("Age");
Names =
((List<object>)info.GetValue("Names", typeof(List<object>)))
Names = info.GetValue<List<object>>("Names")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change intended? The previous code looks rather proper.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought info.GetValue<List<object>>("Names") is better than ((List<object>)info.GetValue("Names", typeof(List<object>))). Do you think previous one is better?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought it is not like better or worse, but just it's unlikely to be compiled. If the type checker passes I don't mind then.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To elaborate, the changed version looks like trying to putting a List<object> value into List<string> property, which C#'s type checker does not allow AFAIK.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is more code below:

.Select(s => (string)s)
.ToList();

So I think it will pass the type checker.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, make sense.

@earlbread earlbread merged commit 85106b0 into planetarium:master Mar 28, 2019
@earlbread earlbread deleted the add-biginteger-bencodex-formatter branch March 28, 2019 13:42
dahlia pushed a commit to dahlia/libplanet that referenced this pull request Mar 9, 2021
…nuget

ci(gh-actions): publish 'Libplanet.Explorer' to NuGet
limebell pushed a commit to limebell/libplanet that referenced this pull request Jul 7, 2021
OnedgeLee pushed a commit to OnedgeLee/libplanet that referenced this pull request Jan 31, 2023
…netarium#159)

* INTERNAL: update configmap-versions.yaml

* INTERNAL: update kustomization.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants