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
intstanding on?" "you're clever, young man, clever," said old lady. "but it'sints 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
Post a Comment