IsScriptable() public static method

public static IsScriptable ( Type t ) : bool
t Type
return bool
示例#1
0
        public static void RegisterScriptableObject(string scriptKey, object instance)
        {
            CheckThread();
            // no call to CheckHtmlAccess(); -- see DRT364
            CheckName(scriptKey, "scriptKey");
            if (instance == null)
            {
                throw new ArgumentNullException("instance");
            }
            Type t = instance.GetType();

            if (!t.IsPublic && !t.IsNestedPublic)
            {
                throw new InvalidOperationException("'instance' type is not public.");
            }

            if (!ManagedObject.IsScriptable(t))
            {
                throw new ArgumentException("No public [ScriptableMember] method was found.", "instance");
            }

            ScriptObject sobj = instance as ScriptObject;

            if (sobj == null)
            {
                sobj = new ManagedObject(instance);
            }

            NativeMethods.moonlight_scriptable_object_register(PluginHost.Handle, scriptKey, sobj.Handle);
        }