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


C# ImportGenericContext.Push方法代码示例

本文整理汇总了C#中Mono.Cecil.ImportGenericContext.Push方法的典型用法代码示例。如果您正苦于以下问题:C# ImportGenericContext.Push方法的具体用法?C# ImportGenericContext.Push怎么用?C# ImportGenericContext.Push使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mono.Cecil.ImportGenericContext的用法示例。


在下文中一共展示了ImportGenericContext.Push方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ImportField

        public FieldReference ImportField(FieldReference field, ImportGenericContext context)
        {
            var declaring_type = ImportType (field.DeclaringType, context);

            context.Push (declaring_type);
            try {
                return new FieldReference {
                    Name = field.Name,
                    DeclaringType = declaring_type,
                    FieldType = ImportType (field.FieldType, context),
                };
            } finally {
                context.Pop ();
            }
        }
开发者ID:KonajuGames,项目名称:cecil,代码行数:15,代码来源:Import.cs

示例2: ImportMethod

        public MethodReference ImportMethod(MethodReference method, ImportGenericContext context)
        {
            if (method.IsGenericInstance)
                return ImportMethodSpecification (method, context);

            var declaring_type = ImportType (method.DeclaringType, context);

            var reference = new MethodReference {
                Name = method.Name,
                HasThis = method.HasThis,
                ExplicitThis = method.ExplicitThis,
                DeclaringType = declaring_type,
                CallingConvention = method.CallingConvention,
            };

            if (method.HasGenericParameters)
                ImportGenericParameters (reference, method);

            context.Push (reference);
            try {
                reference.ReturnType = ImportType (method.ReturnType, context);

                if (!method.HasParameters)
                    return reference;

                var reference_parameters = reference.Parameters;

                var parameters = method.Parameters;
                for (int i = 0; i < parameters.Count; i++)
                    reference_parameters.Add (
                        new ParameterDefinition (ImportType (parameters [i].ParameterType, context)));

                return reference;
            } finally {
                context.Pop();
            }
        }
开发者ID:KonajuGames,项目名称:cecil,代码行数:37,代码来源:Import.cs

示例3: ImportMethodSpecification

        MethodReference ImportMethodSpecification(SR.MethodBase method, ImportGenericContext context)
        {
            var method_info = method as SR.MethodInfo;
            if (method_info == null)
                throw new InvalidOperationException ();

            var element_method = ImportMethod (method_info.GetGenericMethodDefinition (), context, ImportGenericKind.Definition);
            var instance = new GenericInstanceMethod (element_method);
            var arguments = method.GetGenericArguments ();
            var instance_arguments = instance.GenericArguments;

            context.Push (element_method);
            try {
                for (int i = 0; i < arguments.Length; i++)
                    instance_arguments.Add (ImportType (arguments [i], context));

                return instance;
            } finally {
                context.Pop ();
            }
        }
开发者ID:KonajuGames,项目名称:cecil,代码行数:21,代码来源:Import.cs

示例4: ImportGenericInstance

        TypeReference ImportGenericInstance(Type type, ImportGenericContext context)
        {
            var element_type = ImportType (type.GetGenericTypeDefinition (), context, ImportGenericKind.Definition);
            var instance = new GenericInstanceType (element_type);
            var arguments = type.GetGenericArguments ();
            var instance_arguments = instance.GenericArguments;

            context.Push (element_type);
            try {
                for (int i = 0; i < arguments.Length; i++)
                    instance_arguments.Add (ImportType (arguments [i], context));

                return instance;
            } finally {
                context.Pop ();
            }
        }
开发者ID:KonajuGames,项目名称:cecil,代码行数:17,代码来源:Import.cs

示例5: ImportField

        internal FieldReference ImportField(FieldReference field, ImportGenericContext context,
            IImportMapper mapper)
        {
            var mapped = mapper.MapField(field);
            if (mapped == null)
                mapped = field;

            var declaring_type = ImportType(mapped.DeclaringType, context, mapper);

            context.Push (declaring_type);
            try {
                return new FieldReference {
                    Name = mapped.Name,
                    DeclaringType = declaring_type,
                    FieldType = ImportType(mapped.FieldType, context, mapper),
                };
            } finally {
                context.Pop ();
            }
        }
开发者ID:MarkusSintonen,项目名称:MNetInjector,代码行数:20,代码来源:Import.cs


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