Ejemplo n.º 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;
        }
Ejemplo n.º 2
0
 public bool TryGetType(int key, out ScriptType value)
 {
     return this.types.TryGetValue(key, out value);
 }
Ejemplo n.º 3
0
 public ScriptTypeSet(ScriptType type)
     : this()
 {
     this.AddType(type);
 }