• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# RuntimeType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中RuntimeType的典型用法代码示例。如果您正苦于以下问题:C# RuntimeType类的具体用法?C# RuntimeType怎么用?C# RuntimeType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



RuntimeType类属于命名空间,在下文中一共展示了RuntimeType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: TestCaseMethodCompiler

        public TestCaseMethodCompiler(TestCaseAssemblyCompiler assemblyCompiler, ICompilationSchedulerStage compilationScheduler, RuntimeType type, RuntimeMethod method)
            : base(assemblyCompiler, type, method, null, compilationScheduler)
        {
            // Populate the pipeline
            this.Pipeline.AddRange(new IMethodCompilerStage[] {
                new DecodingStage(),
                new BasicBlockBuilderStage(),
                new ExceptionPrologueStage(),
                new OperandDeterminationStage(),
                new StaticAllocationResolutionStage(),
                new CILTransformationStage(),
                //new CILLeakGuardStage() { MustThrowCompilationException = true },

                new	EdgeSplitStage(),
                new DominanceCalculationStage(),
                new PhiPlacementStage(),
                new EnterSSAStage(),

                new ConstantPropagationStage(ConstantPropagationStage.PropagationStage.PreFolding),
                new ConstantFoldingStage() ,
                new ConstantPropagationStage(ConstantPropagationStage.PropagationStage.PostFolding),

                new LeaveSSA(),

                new StrengthReductionStage(),
                new StackLayoutStage(),
                new PlatformStubStage(),
                //new BlockReductionStage(),
                //new LoopAwareBlockOrderStage(),
                new SimpleTraceBlockOrderStage(),
                //new ReverseBlockOrderStage(),  // reverse all the basic blocks and see if it breaks anything
                //new BasicBlockOrderStage()
                new CodeGenerationStage(),
            });
        }
开发者ID:toddhainsworth,项目名称:MOSA-Project,代码行数:35,代码来源:TestCaseMethodCompiler.cs


示例2: CreateMethodCompiler

 public override MethodCompilerBase CreateMethodCompiler(RuntimeType type, RuntimeMethod method)
 {
     IArchitecture arch = this.Architecture;
     MethodCompilerBase mc = new TestCaseMethodCompiler(this.Pipeline.Find<IAssemblyLinker>(), this.Architecture, this.Assembly, type, method);
     arch.ExtendMethodCompilerPipeline(mc.Pipeline);
     return mc;
 }
开发者ID:hj1980,项目名称:Mosa,代码行数:7,代码来源:TestCaseAssemblyCompiler.cs


示例3: ComputeToString

        public static String ComputeToString(MethodBase contextMethod, RuntimeType[] methodTypeArguments, RuntimeParameterInfo[] runtimeParametersAndReturn)
        {
            StringBuilder sb = new StringBuilder(30);
            sb.Append(runtimeParametersAndReturn[0].ParameterTypeString);
            sb.Append(' ');
            sb.Append(contextMethod.Name);
            if (methodTypeArguments.Length != 0)
            {
                String sep = "";
                sb.Append('[');
                foreach (RuntimeType methodTypeArgument in methodTypeArguments)
                {
                    sb.Append(sep);
                    sep = ",";
                    String name = methodTypeArgument.InternalNameIfAvailable;
                    if (name == null)
                        name = ToStringUtils.UnavailableType;
                    sb.Append(methodTypeArgument.Name);
                }
                sb.Append(']');
            }
            sb.Append('(');
            sb.Append(ComputeParametersString(runtimeParametersAndReturn, 1));
            sb.Append(')');

            return sb.ToString();
        }
开发者ID:huamichaelchen,项目名称:corert,代码行数:27,代码来源:RuntimeMethodCommon.cs


示例4: BuildMethodTable

        /// <summary>
        /// Builds the method table.
        /// </summary>
        /// <param name="type">The type.</param>
        public void BuildMethodTable(RuntimeType 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");

            IList<RuntimeMethod> methodTable = typeLayout.GetMethodTable(type);
            AskLinkerToCreateMethodTable(type.FullName + @"$mtable", methodTable, headerlinks);
        }
开发者ID:davidleon,项目名称:MOSA-Project,代码行数:37,代码来源:TypeLayoutStage.cs


示例5: GetSerializationInfo

        public static void GetSerializationInfo(
            SerializationInfo info,
            String name,
            RuntimeType reflectedClass,
            String signature,
            String signature2,
            MemberTypes type,
            Type[] genericArguments)
        {
            if (info == null)
                throw new ArgumentNullException(nameof(info));
            Contract.EndContractBlock();

            String assemblyName = reflectedClass.Module.Assembly.FullName;
            String typeName = reflectedClass.FullName;

            info.SetType(typeof(MemberInfoSerializationHolder));
            info.AddValue("Name", name, typeof(String));
            info.AddValue("AssemblyName", assemblyName, typeof(String));
            info.AddValue("ClassName", typeName, typeof(String));
            info.AddValue("Signature", signature, typeof(String));
            info.AddValue("Signature2", signature2, typeof(String));
            info.AddValue("MemberType", (int)type);
            info.AddValue("GenericArguments", genericArguments, typeof(Type[]));
        }
开发者ID:kouvel,项目名称:coreclr,代码行数:25,代码来源:MemberInfoSerializationHolder.cs


示例6: Signature

 public Signature(IRuntimeFieldInfo fieldHandle, RuntimeType declaringType)
 {
     SignatureStruct signature = new SignatureStruct();
     GetSignature(ref signature, null, 0, fieldHandle.Value, null, declaringType);
     GC.KeepAlive(fieldHandle);
     this.m_signature = signature;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:Signature.cs


示例7: ConstructorIsInvoked

 public void ConstructorIsInvoked()
 {
     RuntimeMember method = new RuntimeType(instance.GetType()).GetConstructor(0);
     Assert.IsNotNull(method);
     TypedValue result = method.Invoke(new object[] {});
     Assert.AreEqual(typeof(SampleClass), result.Type);
 }
开发者ID:abombss,项目名称:fitsharp,代码行数:7,代码来源:RuntimeTypeTest.cs


示例8: RuntimeFramework

        /// <summary>
        /// Construct from a string
        /// </summary>
        /// <param name="s">A string representing the runtime</param>
        public RuntimeFramework(string s)
        {
            runtime = RuntimeType.Any;
            version = new Version();

            string[] parts = s.Split(new char[] { '-' });
            if (parts.Length == 2)
            {
                runtime = (RuntimeType)System.Enum.Parse(typeof(RuntimeType), parts[0], true);
                string vstring = parts[1];
                if (vstring != "")
                    version = new Version(vstring);
            }
            else if (char.ToLower(s[0]) == 'v')
            {
                version = new Version(s.Substring(1));
            }
            else if (char.IsNumber(s[0]))
            {
                version = new Version(s);
            }
            else
            {
                runtime = (RuntimeType)System.Enum.Parse(typeof(RuntimeType), s, true);
                version = Environment.Version;
            }
        }
开发者ID:rmterra,项目名称:AutoTest.Net,代码行数:31,代码来源:RuntimeFramework.cs


示例9: ExplorerMethodCompiler

        public ExplorerMethodCompiler(ExplorerAssemblyCompiler assemblyCompiler, ICompilationSchedulerStage compilationScheduler, RuntimeType type, RuntimeMethod method, CompilerOptions compilerOptions)
            : base(assemblyCompiler, type, method, null, compilationScheduler)
        {
            // Populate the pipeline
            this.Pipeline.AddRange(new IMethodCompilerStage[] {
                new DecodingStage(),
                new BasicBlockBuilderStage(),
                new ExceptionPrologueStage(),
                new OperandDeterminationStage(),
                //new SingleUseMarkerStage(),
                //new OperandUsageAnalyzerStage(),
                new StaticAllocationResolutionStage(),
                new CILTransformationStage(),

                (compilerOptions.EnableSSA) ? new EdgeSplitStage() : null,
                (compilerOptions.EnableSSA) ? new DominanceCalculationStage() : null,
                (compilerOptions.EnableSSA) ? new PhiPlacementStage() : null,
                (compilerOptions.EnableSSA) ? new EnterSSAStage() : null,

                (compilerOptions.EnableSSA) ? new SSAOptimizations() : null,
                //(compilerOptions.EnableSSA) ? new ConstantPropagationStage(ConstantPropagationStage.PropagationStage.PreFolding) : null,
                //(compilerOptions.EnableSSA) ? new ConstantFoldingStage() : null,
                //(compilerOptions.EnableSSA) ? new ConstantPropagationStage(ConstantPropagationStage.PropagationStage.PostFolding) : null,

                (compilerOptions.EnableSSA) ? new LeaveSSA() : null,

                new StrengthReductionStage(),
                new StackLayoutStage(),
                new PlatformStubStage(),
                //new LoopAwareBlockOrderStage(),
                new SimpleTraceBlockOrderStage(),
                //new SimpleRegisterAllocatorStage(),
                new CodeGenerationStage(),
            });
        }
开发者ID:grover,项目名称:MOSA-Project,代码行数:35,代码来源:ExplorerMethodCompiler.cs


示例10: AddElementTypes

        internal static RuntimeType AddElementTypes(SerializationInfo info, RuntimeType type)
        {
            List<int> elementTypes = new List<int>();
            while(type.HasElementType)
            {
                if (type.IsSzArray)
                {
                    elementTypes.Add(SzArray);
                }
                else if (type.IsArray)
                {
                    elementTypes.Add(type.GetArrayRank());
                    elementTypes.Add(Array);
                }
                else if (type.IsPointer)
                {
                    elementTypes.Add(Pointer);
                }
                else if (type.IsByRef)
                {
                    elementTypes.Add(ByRef);
                }
                
                type = (RuntimeType)type.GetElementType();
            }

            info.AddValue("ElementTypes", elementTypes.ToArray(), typeof(int[]));

            return type;
        }
开发者ID:ChuangYang,项目名称:coreclr,代码行数:30,代码来源:UnitySerializationHolder.cs


示例11: FormatRuntimeType

        protected string FormatRuntimeType(RuntimeType type)
        {
            if (!showTokenValues.Checked)
                return type.Namespace + Type.Delimiter + type.Name;

            return "[" + TokenToString(type.Token) + "] " + type.Namespace + Type.Delimiter + type.Name;
        }
开发者ID:davidleon,项目名称:MOSA-Project,代码行数:7,代码来源:Main.cs


示例12: CilGenericType

        /// <summary>
        /// Initializes a new instance of the <see cref="CilGenericType"/> class.
        /// </summary>
        /// <param name="module">The module.</param>
        /// <param name="baseGenericType">Type of the base generic.</param>
        /// <param name="genericTypeInstanceSignature">The generic type instance signature.</param>
        /// <param name="token">The token.</param>
        /// <param name="typeModule">The type module.</param>
        public CilGenericType(ITypeModule module, RuntimeType baseGenericType, GenericInstSigType genericTypeInstanceSignature, Token token, ITypeModule typeModule)
            : base(module, token, baseGenericType.BaseType)
        {
            Debug.Assert(baseGenericType is CilRuntimeType);

            this.signature = genericTypeInstanceSignature;
            this.baseGenericType = baseGenericType as CilRuntimeType;
            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();
        }
开发者ID:davidleon,项目名称:MOSA-Project,代码行数:35,代码来源:CilGenericType.cs


示例13: AttributeUsageCheck

 private static bool AttributeUsageCheck(RuntimeType attributeType, bool mustBeInheritable, object[] attributes, IList derivedAttributes)
 {
     AttributeUsageAttribute attributeUsage = null;
     if (mustBeInheritable)
     {
         attributeUsage = GetAttributeUsage(attributeType);
         if (!attributeUsage.Inherited)
         {
             return false;
         }
     }
     if (derivedAttributes != null)
     {
         for (int i = 0; i < derivedAttributes.Count; i++)
         {
             if (derivedAttributes[i].GetType() == attributeType)
             {
                 if (attributeUsage == null)
                 {
                     attributeUsage = GetAttributeUsage(attributeType);
                 }
                 return attributeUsage.AllowMultiple;
             }
         }
     }
     return true;
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:27,代码来源:CustomAttribute.cs


示例14: GetCustomAttribute

		internal static Attribute GetCustomAttribute(RuntimeType type)
		{
			if ((type.Attributes & TypeAttributes.Serializable) != TypeAttributes.Serializable)
			{
				return null;
			}
			return new SerializableAttribute();
		}
开发者ID:ChristianWulf,项目名称:CSharpKDMDiscoverer,代码行数:8,代码来源:SerializableAttribute.cs


示例15: GetCustomAttribute

 internal static Attribute GetCustomAttribute(RuntimeType type)
 {
     if ((type.Attributes & TypeAttributes.Import) == TypeAttributes.AnsiClass)
     {
         return null;
     }
     return new ComImportAttribute();
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:ComImportAttribute.cs


示例16: RuntimeSyntheticConstructorInfo

 private RuntimeSyntheticConstructorInfo(SyntheticMethodId syntheticMethodId, RuntimeType declaringType, RuntimeType[] runtimeParameterTypesAndReturn, InvokerOptions options, Func<Object, Object[], Object> invoker)
 {
     _syntheticMethodId = syntheticMethodId;
     _declaringType = declaringType;
     _options = options;
     _invoker = invoker;
     _runtimeParameterTypesAndReturn = runtimeParameterTypesAndReturn;
 }
开发者ID:noahfalk,项目名称:corert,代码行数:8,代码来源:RuntimeSyntheticConstructorInfo.cs


示例17: RuntimeConstructorInfo

 internal RuntimeConstructorInfo(RuntimeMethodHandleInternal handle, RuntimeType declaringType, RuntimeType.RuntimeTypeCache reflectedTypeCache, MethodAttributes methodAttributes, System.Reflection.BindingFlags bindingFlags)
 {
     this.m_bindingFlags = bindingFlags;
     this.m_reflectedTypeCache = reflectedTypeCache;
     this.m_declaringType = declaringType;
     this.m_handle = handle.Value;
     this.m_methodAttributes = methodAttributes;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:RuntimeConstructorInfo.cs


示例18: CilRuntimeField

 /// <summary>
 /// Initializes a new instance of the <see cref="CilRuntimeField"/> class.
 /// </summary>
 /// <param name="module">The module.</param>
 /// <param name="name">The name.</param>
 /// <param name="signature">The signature.</param>
 /// <param name="token">The token.</param>
 /// <param name="offset">The offset.</param>
 /// <param name="rva">The rva.</param>
 /// <param name="declaringType">Type of the declaring.</param>
 /// <param name="attributes">The attributes.</param>
 public CilRuntimeField(ITypeModule module, string name, FieldSignature signature, Token token, uint offset, uint rva, RuntimeType declaringType, FieldAttributes attributes)
     : base(module, token, declaringType)
 {
     this.Name = name;
     this.Signature = signature;
     base.Attributes = attributes;
     base.RVA = rva;
 }
开发者ID:jeffreye,项目名称:MOSA-Project,代码行数:19,代码来源:CilRuntimeField.cs


示例19: ConstructorCallMessage

 internal ConstructorCallMessage(object[] callSiteActivationAttributes, object[] womAttr, object[] typeAttr, RuntimeType serverType)
 {
     this._activationType = serverType;
     this._activationTypeName = RemotingServices.GetDefaultQualifiedTypeName(this._activationType);
     this._callSiteActivationAttributes = callSiteActivationAttributes;
     this._womGlobalAttributes = womAttr;
     this._typeAttributes = typeAttr;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:ConstructorCallMessage.cs


示例20: GetMethodTableForType

        private string GetMethodTableForType(RuntimeType allocatedType)
        {
            if (!allocatedType.IsValueType)
            {
                return allocatedType.FullName + @"$mtable";
            }

            return null;
        }
开发者ID:GeroL,项目名称:MOSA-Project,代码行数:9,代码来源:StaticAllocationResolutionStage.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# RuntimeTypeHandle类代码示例发布时间:2022-05-24
下一篇:
C# RuntimePipeline类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap