/// <summary> /// Transforms a Psimulex type to its closest .NET equivalent. /// It is mainly utilized by the SystemCall mechanism. /// </summary> /// <param name="value"></param> /// <param name="type"></param> /// <returns></returns> public static object TransformToDotnetType(BaseType value, Type type) { if (TypeEquals(type, typeof(BaseType))) { return value; } else if (type.IsSubclassOf(typeof(BaseType))) { return value.ConvertTo(GetTypeEnumOfType(type)); } else if (TypeEquals(type, typeof(string))) { return value.ToString(); } else if (TypeEquals(type, typeof(int))) { return (int) value.ToInt(); } else if (TypeEquals(type, typeof(long))) { return value.ToInt(); } else if (TypeEquals(type, typeof(decimal))) { return value.ToDecimal(); } else if (TypeEquals(type, typeof(float))) { return value.ToFloat(); } else if (TypeEquals(type, typeof(bool))) { return value.ToBoolean(); } else if (TypeEquals(type, typeof(char))) { return value.ToChar(); } else return null; }