本文整理汇总了C#中Utilities.Reflection.Emit.Assembly.CreateType方法的典型用法代码示例。如果您正苦于以下问题:C# Utilities.Reflection.Emit.Assembly.CreateType方法的具体用法?C# Utilities.Reflection.Emit.Assembly.CreateType怎么用?C# Utilities.Reflection.Emit.Assembly.CreateType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utilities.Reflection.Emit.Assembly
的用法示例。
在下文中一共展示了Utilities.Reflection.Emit.Assembly.CreateType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateType
public void CreateType()
{
Utilities.Reflection.Emit.Assembly TestObject = new Utilities.Reflection.Emit.Assembly("TestingThis");
Utilities.Reflection.Emit.TypeBuilder TypeObject = TestObject.CreateType("TestClass");
Assert.NotNull(TypeObject);
TestObject.Create();
}
示例2: GetDefinition
public void GetDefinition()
{
Utilities.Reflection.Emit.Assembly Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
Utilities.Reflection.Emit.FieldBuilder Field = TestType.CreateField("Field1", typeof(int));
Assert.NotEmpty(Field.GetDefinition());
}
示例3: GetDefinition
public void GetDefinition()
{
Utilities.Reflection.Emit.Assembly Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
Utilities.Reflection.Emit.Interfaces.IPropertyBuilder Property = TestType.CreateDefaultProperty("Property1", typeof(int));
Assert.NotEmpty(Property.GetDefinition());
}
示例4: Load
public void Load()
{
Utilities.Reflection.Emit.Assembly Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
IMethodBuilder Method = TestType.CreateMethod("TestMethod");
VariableBase Local1 = Method.CreateLocal("Local1", typeof(int));
Assert.DoesNotThrow<Exception>(() => Local1.Load(Method.Generator));
}
示例5: Save
public void Save()
{
Utilities.Reflection.Emit.Assembly Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
IMethodBuilder Method = TestType.CreateMethod("TestMethod");
VariableBase Local1 = Method.CreateLocal("Local1", typeof(int));
Local1.Save(Method.Generator);
}
示例6: Call
public void Call()
{
Utilities.Reflection.Emit.Assembly Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
IMethodBuilder Method = TestType.CreateMethod("TestMethod");
Utilities.Reflection.Emit.FieldBuilder Field = TestType.CreateField("Field1", typeof(int));
Assert.DoesNotThrow<Exception>(() => Field.Call("ToString"));
}
示例7: Call
public void Call()
{
Utilities.Reflection.Emit.Assembly Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
IMethodBuilder Method = TestType.CreateMethod("TestMethod");
VariableBase Local1 = Method.CreateLocal("Local1", typeof(int));
Assert.DoesNotThrow(() => Local1.Call("ToString"));
}
示例8: Create
public void Create()
{
Utilities.Reflection.Emit.Assembly Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
Assert.NotNull(TestType);
Assert.DoesNotThrow<Exception>(() => Assembly.Create());
Assert.NotNull(Activator.CreateInstance(TestType.DefinedType));
}
示例9: PlusPlus
public void PlusPlus()
{
Utilities.Reflection.Emit.Assembly Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
IMethodBuilder Method = TestType.CreateConstructor();
Utilities.Reflection.Emit.PropertyBuilder TestProperty = (Utilities.Reflection.Emit.PropertyBuilder)TestType.CreateProperty("TestProperty", typeof(int));
Assert.DoesNotThrow(() => ++TestProperty);
}
示例10: Assign
public void Assign()
{
Utilities.Reflection.Emit.Assembly Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
IMethodBuilder Method = TestType.CreateMethod("TestMethod");
Utilities.Reflection.Emit.FieldBuilder Field = TestType.CreateField("Field1", typeof(int));
Assert.DoesNotThrow(() => Field.Assign(12));
}
示例11: Load
public void Load()
{
Utilities.Reflection.Emit.Assembly Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
Utilities.Reflection.Emit.FieldBuilder Field = TestType.CreateField("Field1", typeof(int));
IMethodBuilder Method = TestType.CreateMethod("TestMethod");
Field.Load(Method.Generator);
}
示例12: MinusMinus
public void MinusMinus()
{
Utilities.Reflection.Emit.Assembly Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
IMethodBuilder Method = TestType.CreateConstructor();
Utilities.Reflection.Emit.PropertyBuilder TestProperty = (Utilities.Reflection.Emit.PropertyBuilder)TestType.CreateProperty("TestProperty", typeof(int));
--TestProperty;
}
示例13: Save
public void Save()
{
Utilities.Reflection.Emit.Assembly Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
IMethodBuilder Method = TestType.CreateConstructor();
Utilities.Reflection.Emit.PropertyBuilder TestProperty = (Utilities.Reflection.Emit.PropertyBuilder)TestType.CreateProperty("TestProperty", typeof(int));
Assert.Throws<NullReferenceException>(() => TestProperty.Save(null));
Assert.DoesNotThrow(() => TestProperty.Save(Method.Generator));
}
示例14: Create
public void Create()
{
Utilities.Reflection.Emit.Assembly Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
Utilities.Reflection.Emit.Interfaces.IMethodBuilder Constructor = TestType.CreateConstructor();
VariableBase Constant = Constructor.CreateConstant(12);
Assert.NotNull(Constant);
Assert.Equal(typeof(int), Constant.DataType);
}
示例15: Box
public void Box()
{
Utilities.Reflection.Emit.Assembly Assembly = new Utilities.Reflection.Emit.Assembly("TestAssembly");
Utilities.Reflection.Emit.TypeBuilder TestType = Assembly.CreateType("TestType");
IMethodBuilder Method = TestType.CreateMethod("TestMethod");
VariableBase Local1 = Method.CreateLocal("Local1", typeof(int));
VariableBase Local2 = Method.CreateLocal("Local2", typeof(int));
Assert.NotNull(Method.Box(Local1));
}