本文整理汇总了C#中Scorpio.ScriptObject.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# ScriptObject.GetType方法的具体用法?C# ScriptObject.GetType怎么用?C# ScriptObject.GetType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Scorpio.ScriptObject
的用法示例。
在下文中一共展示了ScriptObject.GetType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CanChangeType
public static bool CanChangeType(ScriptObject par, Type type)
{
if (type == TYPE_OBJECT)
return true;
else if (IsNumber(type))
return par is ScriptNumber;
else if (IsBool(type))
return par is ScriptBoolean;
else if (IsEnum(type))
return par is ScriptEnum && ((ScriptEnum)par).EnumType == type;
else if (par is ScriptNull)
return true;
else if (IsString(type))
return par is ScriptString;
else if (IsDelegateType(type))
return (par is ScriptFunction) || (par is ScriptUserdata && (par as ScriptUserdata).ValueType == type);
else if (IsType(type))
return par is ScriptUserdata;
else if (par is ScriptUserdata)
return type.IsAssignableFrom(((ScriptUserdata)par).ValueType);
else
return type.IsAssignableFrom(par.GetType());
}
示例2: CanChangeType
public static bool CanChangeType(ScriptObject par, Type type)
{
if (type == TYPE_OBJECT)
return true;
else if (type == TYPE_SBYTE || type == TYPE_BYTE || type == TYPE_SHORT || type == TYPE_USHORT || type == TYPE_INT || type == TYPE_UINT ||
type == TYPE_FLOAT || type == TYPE_DOUBLE || type == TYPE_DECIMAL || type == TYPE_LONG)
return par is ScriptNumber;
else if (type == TYPE_BOOL)
return par is ScriptBoolean;
else if (type.GetTypeInfo().IsEnum)
return par is ScriptEnum && ((ScriptEnum)par).EnumType == type;
else if (par is ScriptNull)
return true;
else if (type == TYPE_STRING)
return par is ScriptString;
else if (type == TYPE_TYPE)
return par is ScriptUserdata;
else if (TYPE_DELEGATE.GetTypeInfo().IsAssignableFrom(type))
return (par is ScriptFunction) || (par is ScriptUserdata && (par as ScriptUserdata).ValueType == type);
else if (par is ScriptUserdata)
return type.GetTypeInfo().IsAssignableFrom(((ScriptUserdata)par).ValueType);
else
return type.GetTypeInfo().IsAssignableFrom(par.GetType());
}