Example #1
0
        public void AddType(ScriptType type)
        {
            if (type == null)
                throw new ArgumentNullException("type");

            if (!type.IsGenericType || !type.IsGenericTypeDefinition)
                throw new ScriptExecutionException("ScriptTypeSet may only contain generic types which are also generic type definitions.");

            if (!this.types.ContainsKey(type.GenericArgumentCount))
            {
                this.types[type.GenericArgumentCount] = type;
            }
            else
            {
                throw new ScriptExecutionException(string.Format("Unable to add type \"{0}\" to ScriptTypeSet.", type.Type.Name));
            }

            this.types[type.GenericArgumentCount] = type;
        }
Example #2
0
 public bool TryGetType(int key, out ScriptType value)
 {
     return this.types.TryGetValue(key, out value);
 }
Example #3
0
 public ScriptTypeSet(ScriptType type)
     : this()
 {
     this.AddType(type);
 }