I am writing interop between php service and our crm. One of the things I need to do is make sure that simple types are converted to ToString () for use later in the json converter.
Iβm not even sure what the name is for "simple types", but it can be defined as follows ... "an object that represents the type of a low-level variable containing a single value, not a class or anything with an executable function, etc. d.
I found that int, string, bool, double and surprisingly listed would be ToString () with pretty predictable results.
int x = 0;
bool y = true;
double z = 1.59
CustomEnum theEnum = CustomEnum.somevalue;
x.ToString () results in "0"
y.ToString () yields true
z.ToString () results in "1.59"
theEnum.ToString () results in "somevalue"
:
List<int> iList = new List<int>();
iList.Add(1);
MyClass theClass = new MyClass();
iList.ToString() "System.Collections.Generic.List`1 [System.Int32]"
theClass.ToString() "STTI.NKI.Interop.MyClass"
. ExpandoObject, ..
, , , , ToString() , . , -
switch (theObject.GetType())
case typeof(int):
case typeof(bool):
case typeof(doulble):
etc
, , .