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


C# Internal.ToInt方法代码示例

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


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

示例1: CreateCellFromFixupKindAndToken


//.........这里部分代码省略.........
                        cell = new StaticDataCell() { DataKind = staticDataKind, Type = type, Direct = true };
                    }
                    break;

                case MetadataFixupKind.UnwrapNullableType:
                    {
                        var type = metadata.GetType(token);
                        TypeLoaderLogger.WriteLine("UnwrapNullableType of: " + type.ToString());

                        cell = new UnwrapNullableTypeCell() { Type = (DefType)type };
                    }
                    break;

                case MetadataFixupKind.FieldLdToken:
                    {
                        var field = metadata.GetField(token);

                        TypeLoaderLogger.WriteLine("LdToken on: " + field.ToString());
                        IntPtr fieldName = TypeLoaderEnvironment.Instance.GetNativeFormatStringForString(field.Name);
                        cell = new FieldLdTokenCell() { FieldName = fieldName, ContainingType = field.OwningType };
                    }
                    break;

                case MetadataFixupKind.MethodLdToken:
                    {
                        var method = metadata.GetMethod(token);
                        TypeLoaderLogger.WriteLine("LdToken on: " + method.ToString());
                        var nativeFormatMethod = (TypeSystem.NativeFormat.NativeFormatMethod)method.GetTypicalMethodDefinition();

                        cell = new MethodLdTokenCell
                        {
                            Method = method,
                            MethodName = IntPtr.Zero,
                            MethodSignature = RuntimeMethodSignature.CreateFromMethodHandle(nativeFormatMethod.MetadataUnit.RuntimeModule, nativeFormatMethod.Handle.ToInt())
                        };
                    }
                    break;

                case MetadataFixupKind.TypeSize:
                    {
                        var type = metadata.GetType(token);
                        TypeLoaderLogger.WriteLine("TypeSize: " + type.ToString());

                        cell = new TypeSizeCell() { Type = type };
                    }
                    break;

                case MetadataFixupKind.FieldOffset:
                    {
                        var field = metadata.GetField(token);
                        TypeLoaderLogger.WriteLine("FieldOffset: " + field.ToString());

                        cell = new FieldOffsetCell() { Field = field };
                    }
                    break;

                case MetadataFixupKind.AllocateObject:
                    {
                        var type = metadata.GetType(token);
                        TypeLoaderLogger.WriteLine("AllocateObject on: " + type.ToString());

                        cell = new AllocateObjectCell { Type = type };
                    }
                    break;

                case MetadataFixupKind.DefaultConstructor:
开发者ID:nattress,项目名称:corert,代码行数:67,代码来源:genericdictionarycell.cs

示例2: GetSignature

        public RuntimeMethodSignature GetSignature(Internal.Metadata.NativeFormat.Handle token)
        {
            switch (token.HandleType)
            {
                // These are the only valid token types for creating a method signature
                case Internal.Metadata.NativeFormat.HandleType.Method:
                case Internal.Metadata.NativeFormat.HandleType.MemberReference:
                case Internal.Metadata.NativeFormat.HandleType.QualifiedMethod:
                case Internal.Metadata.NativeFormat.HandleType.MethodInstantiation:
                case Internal.Metadata.NativeFormat.HandleType.MethodSignature:
                    break;

                default:
                    Environment.FailFast("Unknown and invalid handle type");
                    break;
            }
            return RuntimeMethodSignature.CreateFromMethodHandle(_metadataUnit.RuntimeModule, token.ToInt());
        }
开发者ID:nattress,项目名称:corert,代码行数:18,代码来源:FixupCellMetadataResolver.cs


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