当前位置: 首页>>代码示例>>C#>>正文


C# Assembly.CreateInstance方法代码示例

本文整理汇总了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"));
    }
开发者ID:jesantana,项目名称:RSAGenerator,代码行数:28,代码来源:GestorDibujables.cs

示例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);
     }
 }
开发者ID:stevedonovan,项目名称:cs-repl,代码行数:29,代码来源:interpreter.cs

示例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;
 }
开发者ID:jesantana,项目名称:RSAGenerator,代码行数:8,代码来源:GestorDibujables.cs

示例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);
     }	    
 }    
开发者ID:oleg-shilo,项目名称:cs-script,代码行数:9,代码来源:interpreter.cs

示例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;
            }
开发者ID:JauchOnGitHub,项目名称:csharptoolbox,代码行数:11,代码来源:Script.cs


注:本文中的Assembly.CreateInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。