c# - int vs Int32. Are they really aliases? -


this question has answer here:

after looking @ source code int32 while doing research why datacontractserializer not serialize struct when using int works fine, came across curious bit of code

public struct int32 : ... {    internal int m_value;     public const int maxvalue = 0x7fffffff; 

if int32 , int aliases why on earth int declared inside int32?

int vs. int32 irrelevant issue. field displayed int because tool use @ replaces types aliases when displays them. if @ lower level tool you'll see doesn't know int, int32.

the problem int32 struct contains int32 field.

"what int standing on?" "you're clever, young man, clever," said old lady. "but it's ints way down!"

the solution problem magic. runtime knows int32 , gives special treatment avoiding infinite recursion. can't write custom struct contains field. int32 built in type, no normal struct. appears struct consistency's sake.


Comments

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -