Converting bytes to GB in C#?

前端 未结 13 933
孤城傲影
孤城傲影 2020-12-23 12:09

I was refactoring some old code and came across the following line of code to convert bytes to GB.

decimal GB = KB / 1024 / 1024 / 1024;

Is

13条回答
  •  萌比男神i
    2020-12-23 12:11

    Personally I'd write it like this: decimal GB = KB / (1024 * 1024); but there's really no need to refactor the code as written.

提交回复
热议问题