本文整理匯總了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());
}