本文整理汇总了C#中Assembly.CreateInstance方法的典型用法代码示例。如果您正苦于以下问题:C# Assembly.CreateInstance方法的具体用法?C# Assembly.CreateInstance怎么用?C# Assembly.CreateInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Assembly
的用法示例。
在下文中一共展示了Assembly.CreateInstance方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GeneraDibujables
public virtual ParticulaDibujable[] GeneraDibujables(Particula[] particula,float[] color,bool aleat)
{
ArrayList result=new ArrayList();
for (int i = 0; i < particula.Length; i++)
{
if(particula[i]==null)return (ParticulaDibujable[])result.ToArray(Type.GetType("ParticulaDibujable"));
try
{
if(tempInfo==null || tempInfo.Nombre!=particula[i].GetType().Name)
{
tempInfo=pinfo.GetInfoParticulas(particula[i].GetType().Name);
}
}
catch (Exception ex) { throw new Exception("Error al Generar Particulas Dibujables"); }
assem=GestorEnsamblados.GetAssemblyByName(tempInfo.EnsambladoDibujable,tempInfo.PathDibujable);
if(aleat)
{
result.Add((ParticulaDibujable)assem.CreateInstance(tempInfo.NombreDibujable, true, BindingFlags.CreateInstance, null, new object[] {particula[i]}, null, null));
}
else
{
result.Add((ParticulaDibujable)assem.CreateInstance(tempInfo.NombreDibujable, true, BindingFlags.CreateInstance, null, new object[] {particula[i], color}, null, null));
}
}
return (ParticulaDibujable[])result.ToArray(Type.GetType("ParticulaDibujable"));
}
示例2: Instantiate
public static void Instantiate(Assembly a, Interpreter interp)
{
Hashtable table = interp.VarTable;
try {
CodeChunk chunk = (CodeChunk)a.CreateInstance("CsiChunk");
chunk.Go(table);
// vs 0.8 we display the type and value of expressions. The variable $_ is
// always set, which is useful if you want to save the result of the last
// calculation.
if (interp.returnsValue && DumpingValue) {
object val = table["_"];
Type type = val.GetType();
string stype = type.ToString();
if (stype.StartsWith("System.")) // to simplify things a little bit...
stype = stype.Substring(7);
stype = "("+stype+")";
if (val is string) {
Print(stype,"'"+val+"'");
} else
if (val is IEnumerable) {
Print(stype);
Dumpl((IEnumerable)val);
} else
Print(stype,val);
}
} catch(Exception ex) {
Print(ex.GetType() + " was thrown: " + ex.Message);
}
}
示例3: GeneraAnsysWriter
public virtual ANSYSWriter GeneraAnsysWriter(string particulaName,RSA owner)
{
ANSYSWriter ansysReturn = null;
tempInfo = pinfo.GetInfoParticulas(particulaName);
assem = GestorEnsamblados.GetAssemblyByName(tempInfo.EnsambladoDibujable, tempInfo.PathDibujable);
ansysReturn=(ANSYSWriter)assem.CreateInstance(tempInfo.AnsysWriterName, true, BindingFlags.CreateInstance, null, new object[] {owner}, null, null);
return ansysReturn;
}
示例4: Instantiate
public static void Instantiate(Assembly a, Hashtable table, string className, string funName) {
try {
CsiFunctionContext dll = (CsiFunctionContext)a.CreateInstance(className);
dll.V = table;
table[className] = dll;
} catch(Exception ex) {
Print(ex.GetType() + " was thrown: " + ex.Message);
}
}
示例5: FindScriptInterface
public object FindScriptInterface(string interfaceName, Assembly compiledAssembly, string task_class)
{
if (compiledAssembly == null)
return null;
Type t = compiledAssembly.GetType(task_class);
if (t.GetInterface(interfaceName, true) != null)
return compiledAssembly.CreateInstance(t.FullName);
return null;
}