本文整理汇总了C#中System.RuntimeType类的典型用法代码示例。如果您正苦于以下问题:C# RuntimeType类的具体用法?C# RuntimeType怎么用?C# RuntimeType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RuntimeType类属于System命名空间,在下文中一共展示了RuntimeType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CilGenericType
/// <summary>
/// Initializes a new instance of the <see cref="CilGenericType"/> class.
/// </summary>
/// <param name="typeModule">The type module.</param>
/// <param name="token">The token.</param>
/// <param name="baseGenericType">Type of the base generic.</param>
/// <param name="genericTypeInstanceSignature">The generic type instance signature.</param>
public CilGenericType(ITypeModule typeModule, Token token, RuntimeType baseGenericType, GenericInstSigType genericTypeInstanceSignature)
: base(baseGenericType.Module, token, baseGenericType.BaseType)
{
Debug.Assert(baseGenericType is CilRuntimeType);
this.signature = genericTypeInstanceSignature;
this.baseGenericType = baseGenericType as CilRuntimeType;
this.InstantiationModule = typeModule;
base.Attributes = baseGenericType.Attributes;
base.Namespace = baseGenericType.Namespace;
if (this.baseGenericType.IsNested)
{
// TODO: find generic type
;
}
// TODO: if this is a nested types, add enclosing type(s) into genericArguments first
this.genericArguments = signature.GenericArguments;
base.Name = GetName(typeModule);
ResolveMethods();
ResolveFields();
this.containsOpenGenericArguments = CheckContainsOpenGenericParameters();
}
示例2: RuntimeMember
/// <summary>
/// Initializes a new instance of <see cref="RuntimeMember"/>.
/// </summary>
/// <param name="token">Holds the token of this runtime metadata.</param>
/// <param name="module">The module.</param>
/// <param name="declaringType">The declaring type of the member.</param>
/// <param name="attributes">Holds the attributes of the member.</param>
protected RuntimeMember(int token, IMetadataModule module, RuntimeType declaringType, RuntimeAttribute[] attributes)
: base(token)
{
this.module = module;
this.declaringType = declaringType;
this.attributes = attributes;
}
示例3: CreateRuntimeInternal
private static CloudRuntime CreateRuntimeInternal(RuntimeType runtimeType, string roleName, string rolePath)
{
CloudRuntime runtime;
switch (runtimeType)
{
case RuntimeType.Null:
runtime = new NullCloudRuntime();
break;
case RuntimeType.Cache:
runtime = new CacheCloudRuntime();
break;
case RuntimeType.PHP:
runtime = new PHPCloudRuntime();
break;
case RuntimeType.IISNode:
runtime = new IISNodeCloudRuntime();
break;
case RuntimeType.Node:
default:
runtime = new NodeCloudRuntime();
break;
}
runtime.Runtime = runtimeType;
runtime.RoleName = roleName;
runtime.FilePath = rolePath;
return runtime;
}
示例4: BuildMethodTable
/// <summary>
/// Builds the method table.
/// </summary>
/// <param name="type">The type.</param>
public void BuildMethodTable(RuntimeType type)
{
IList<RuntimeMethod> methodTable = CreateMethodTable(type);
// HINT: The method table is offset by a four pointers:
// 1. interface dispatch table pointer
// 2. type pointer - contains the type information pointer, used to realize object.GetType().
// 3. interface bitmap
// 4. parent type (if any)
List<string> headerlinks = new List<string>();
// 1. interface dispatch table pointer
if (type.Interfaces.Count == 0)
headerlinks.Add(null);
else
headerlinks.Add(type.FullName + @"$itable");
// 2. type pointer - contains the type information pointer, used to realize object.GetType().
headerlinks.Add(null); // TODO: GetType()
// 3. interface bitmap
if (type.Interfaces.Count == 0)
headerlinks.Add(null);
else
headerlinks.Add(type.FullName + @"$ibitmap");
// 4. parent type (if any)
if (type.BaseType == null)
headerlinks.Add(null);
else
headerlinks.Add(type.BaseType + @"$mtable");
AskLinkerToCreateMethodTable(type.FullName + @"$mtable", methodTable, headerlinks);
}
示例5: CreateRuntimeInternal
private static CloudRuntime CreateRuntimeInternal(RuntimeType runtimeType, string roleName, string rolePath)
{
CloudRuntime runtime;
switch (runtimeType)
{
case RuntimeType.Null:
runtime = new NullCloudRuntime();
break;
case RuntimeType.Cache:
//Scaffolding for cache is no longer supported
throw new NotSupportedException(Resources.CacheScaffoldingIsNotSupport);
case RuntimeType.PHP:
runtime = new PHPCloudRuntime();
break;
case RuntimeType.IISNode:
runtime = new IISNodeCloudRuntime();
break;
case RuntimeType.Node:
default:
runtime = new NodeCloudRuntime();
break;
}
runtime.Runtime = runtimeType;
runtime.RoleName = roleName;
runtime.FilePath = rolePath;
return runtime;
}
示例6: TestCaseMethodCompiler
public TestCaseMethodCompiler(IAssemblyLinker linker, IArchitecture architecture, IMetadataModule module, RuntimeType type, RuntimeMethod method)
: base(linker, architecture, module, type, method)
{
// Populate the pipeline
this.Pipeline.AddRange(new IMethodCompilerStage[] {
new DecodingStage(),
new BasicBlockBuilderStage(),
new OperandDeterminationStage(),
new InstructionLogger(),
//new ConstantFoldingStage(),
new CILTransformationStage(),
//new InstructionLogger(),
//InstructionStatisticsStage.Instance,
//new DominanceCalculationStage(),
//new EnterSSA(),
//new ConstantPropagationStage(),
//new ConstantFoldingStage(),
//new LeaveSSA(),
new StackLayoutStage(),
new PlatformStubStage(),
new InstructionLogger(),
//new BlockReductionStage(),
new LoopAwareBlockOrderStage(),
//new SimpleTraceBlockOrderStage(),
//new ReverseBlockOrderStage(), // reverse all the basic blocks and see if it breaks anything
//new BasicBlockOrderStage()
new CodeGenerationStage(),
//new InstructionLogger(),
});
}
示例7: SimpleJitMethodCompiler
public SimpleJitMethodCompiler(AssemblyCompiler compiler, ICompilationSchedulerStage compilationScheduler, RuntimeType type, RuntimeMethod method, Stream codeStream, ITypeSystem typeSystem)
: base(compiler.Pipeline.FindFirst<IAssemblyLinker>(), compiler.Architecture, compilationScheduler, type, method, typeSystem, compiler.Pipeline.FindFirst<ITypeLayout>())
{
if (codeStream == null)
throw new ArgumentNullException(@"codeStream");
this.codeStream = codeStream;
}
示例8: RuntimeInspectionOnlyConstructedGenericType
internal RuntimeInspectionOnlyConstructedGenericType(RuntimeType genericTypeDefinition, RuntimeType[] genericTypeArguments)
: base(new ConstructedGenericTypeKey(genericTypeDefinition, genericTypeArguments))
{
// We know this is a nop since just passed the key to our base class. However, we do want this subclass to follow
// the PrepareKey() protocol without relying on knowledge about the base class so we'll go by the book and call it
// anyway so that our GetHashCode() method is justified in not calling it again.
this.PrepareKey();
}
示例9: MethodCompiler
public MethodCompiler(IAssemblyLinker linker, IArchitecture architecture, IMetadataModule module, RuntimeType type, RuntimeMethod method, Stream codeStream)
: base(linker, architecture, module, type, method)
{
if (null == codeStream)
throw new ArgumentNullException(@"codeStream");
_codeStream = codeStream;
}
示例10: CompilerGeneratedMethod
/// <summary>
/// Initializes a new instance of the <see cref="CompilerGeneratedMethod"/> class.
/// </summary>
/// <param name="module">The module.</param>
/// <param name="name">The name of the method.</param>
/// <param name="declaringType">Type of the declaring.</param>
public CompilerGeneratedMethod(IMetadataModule module, string name, RuntimeType declaringType)
: base(0, module, declaringType)
{
if (name == null)
throw new ArgumentNullException(@"name");
this.name = name;
this.Parameters = new List<RuntimeParameter>();
}
示例11: CilRuntimeField
/// <summary>
/// Initializes a new instance of the <see cref="CilRuntimeField"/> class.
/// </summary>
/// <param name="module">The module.</param>
/// <param name="field">The field.</param>
/// <param name="offset">The offset.</param>
/// <param name="rva">The rva.</param>
/// <param name="declaringType">Type of the declaring.</param>
public CilRuntimeField(IMetadataModule module, ref FieldRow field, IntPtr offset, IntPtr rva, RuntimeType declaringType)
: base(module, declaringType)
{
this.nameIdx = field.NameStringIdx;
this.signature = field.SignatureBlobIdx;
base.Attributes = field.Flags;
base.RVA = rva;
//base.Offset = offset; ?
}
示例12: CilRuntimeField
/// <summary>
/// Initializes a new instance of the <see cref="CilRuntimeField"/> class.
/// </summary>
/// <param name="moduleTypeSystem">The module type system.</param>
/// <param name="field">The field.</param>
/// <param name="offset">The offset.</param>
/// <param name="rva">The rva.</param>
/// <param name="declaringType">Type of the declaring.</param>
public CilRuntimeField(IModuleTypeSystem moduleTypeSystem, FieldRow field, uint offset, uint rva, RuntimeType declaringType)
: base(moduleTypeSystem, declaringType)
{
this.nameIdx = field.NameStringIdx;
this.signatureBlobIdx = field.SignatureBlobIdx;
base.Attributes = field.Flags;
base.RVA = rva;
//base.Offset = offset; ?
}
示例13: CilGenericType
public CilGenericType(RuntimeType type, IMetadataModule referencingModule, GenericInstSigType genericTypeInstanceSignature, ISignatureContext signatureContext)
: base(type.Token, type.Module)
{
this.signature = genericTypeInstanceSignature;
this.signatureContext = signatureContext;
this.signatureModule = referencingModule;
this.Methods = this.GetMethods();
this.Fields = this.GetFields();
}
示例14: LinkerGeneratedMethod
/// <summary>
/// Initializes a new instance of the <see cref="LinkerGeneratedMethod"/> class.
/// </summary>
/// <param name="typeSystem">The type system.</param>
/// <param name="name">The name of the method.</param>
/// <param name="declaringType">Type of the declaring.</param>
public LinkerGeneratedMethod(IModuleTypeSystem typeSystem, string name, RuntimeType declaringType)
: base(typeSystem, 0, declaringType)
{
if (name == null)
throw new ArgumentNullException(@"name");
this.name = name;
this.signature = new MethodSignature(new SigType(CilElementType.Void), new SigType[0]);
this.Parameters = new List<RuntimeParameter>();
}
示例15: CilGenericMethod
public CilGenericMethod(IModuleTypeSystem moduleTypeSystem, CilRuntimeMethod method, MethodSignature signature, RuntimeType declaringType)
: base(moduleTypeSystem, method.Token, declaringType)
{
this.genericMethod = method;
this.Signature = signature;
this.Attributes = method.Attributes;
this.ImplAttributes = method.ImplAttributes;
this.Rva = method.Rva;
this.Parameters = method.Parameters;
}