search

Home  >  Q&A  >  body text

java - Why can these integers 1,100 be used directly in C#?

I suddenly thought today, are the integers 1, 2, 3, and 100 defined in C#? Why can they be used directly?

for example,

100.ToString()

var temp = 1000

But when I look at the definition of Int32 in C#, I just write a minimum value and a maximum value,

Still don’t quite understand.

Is it encoding?

C# Int32 source code

仅有的幸福仅有的幸福2771 days ago614

reply all(1)I'll reply

  • 滿天的星座

    滿天的星座2017-05-18 10:46:41

    The minimum and maximum values ​​are const, which are so-called static variables.
    ToString() is a member function.
    1, 2, 3, and 100 are all instances of Int32. Of course,
    instances can access the member function.

    reply
    0
  • Cancelreply