當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。