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