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

ByteSize of zero returns unexpected formatting of " b" #21

Closed
atifaziz opened this issue Nov 9, 2016 · 5 comments
Closed

ByteSize of zero returns unexpected formatting of " b" #21

atifaziz opened this issue Nov 9, 2016 · 5 comments

Comments

@atifaziz
Copy link
Contributor

atifaziz commented Nov 9, 2016

Console.WriteLine(new ByteSize(0).ToString());
Console.WriteLine(ByteSize.FromBytes(0).ToString());
Console.WriteLine(ByteSize.MinValue.ToString());

All of the above return (space following by a lowercase B):

 b
 b
 b

I'm guessing this is not the intended behavior? Certainly isn't desired.

@omar
Copy link
Owner

omar commented Nov 9, 2016

This is indeed not desired. The output of each of those should be 0 b.

I'll take a look at this tonight and see if I can patch this. Thanks for pointing this out.

@atifaziz
Copy link
Contributor Author

atifaziz commented Nov 9, 2016

I'll take a look at this tonight and see if I can patch this.

If you don't get the chance tonight then let me know and I can send a PR tomorrow if it'd help.

@omar omar closed this as completed in 2b5d852 Nov 10, 2016
@omar
Copy link
Owner

omar commented Nov 10, 2016

I just pushed out v1.2.3 on NuGet with this fix. Would like to get your take on the fix though as I'm not too familiar with the best approach to handle custom ToString methods.

omar added a commit that referenced this issue Nov 10, 2016
@atifaziz
Copy link
Contributor Author

Thanks for the quick turn around on the fix and pushing out a new version! My local fix was exactly the same (i.e. use 0.## instead of #.##) and what I was intending to submit as a PR.

@omar
Copy link
Owner

omar commented Nov 10, 2016

Happy to help. Glad you're getting value out of this library.

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

No branches or pull requests

2 participants