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


C# CorElementType类代码示例

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


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

示例1: IsValid

 public static bool IsValid(CorElementType elementType)
 {
     return (CorElementType.End <= elementType && elementType <= CorElementType.Max) ||
         elementType == CorElementType.Modifier ||
         elementType == CorElementType.Sentinel ||
         elementType == CorElementType.Pinned;
 }
开发者ID:JianwenSun,项目名称:cc,代码行数:7,代码来源:MiniParameterInfo.cs

示例2: MiniParameterInfo

        public MiniParameterInfo(CorElementType elementType)
        {
            System.Diagnostics.Contracts.Contract.Requires(elementType <= CorElementType.String || 
                elementType == CorElementType.I || elementType == CorElementType.U ||
                elementType == CorElementType.Object);

            _elementType = elementType;
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:8,代码来源:MiniParameterInfo.cs

示例3: DebuggerType

 public DebuggerType(Debugger debugger, CorType type, uint token = 0)
 {
     debugger.Dispatcher.VerifyAccess();
     this.debugger = debugger;
     this.type = type;
     this.hashCode = type.GetHashCode();
     this.elementType = (CorElementType)type.ElementType;
     this.attributes = type.GetTypeAttributes();
     this.token = token;
     this.tokenInitd = token != 0;
 }
开发者ID:yueding,项目名称:dnSpy,代码行数:11,代码来源:DebuggerType.cs

示例4: CorFieldInfo

		public CorFieldInfo(CorType ownerType, uint token, string name, TypeSig fieldType, FieldAttributes attrs, object constant, CorElementType constantType, DebuggerBrowsableState? debuggerBrowsableState, bool compilerGeneratedAttribute) {
			this.OwnerType = ownerType;
			this.Token = token;
			this.Name = name;
			this.FieldType = fieldType;
			this.Attributes = attrs;
			this.Constant = constant;
			this.ConstantType = constantType;
			this.DebuggerBrowsableState = debuggerBrowsableState;
			this.CompilerGeneratedAttribute = compilerGeneratedAttribute;
		}
开发者ID:nakijun,项目名称:dnSpy,代码行数:11,代码来源:MetaDataUtils.cs

示例5: GetParameterizedType

        public CorType GetParameterizedType(CorElementType elementType, CorType[] typeArguments)
        {
            ICorDebugType[] types = null;
            uint length = 0;
            if (typeArguments != null)
            {
                types = new ICorDebugType[typeArguments.Length];
                for (int i = 0; i < typeArguments.Length; i++)
                    types[i] = typeArguments[i].m_type;
                length = (uint)typeArguments.Length;
            }

            ICorDebugType pType;
            (m_class as ICorDebugClass2).GetParameterizedType(elementType, length, types, out pType);
            return pType==null?null:new CorType (pType);
        }
开发者ID:Gravecorp,项目名称:ipydbg,代码行数:16,代码来源:Class.cs

示例6: GetPrimitiveType

		IDebuggerType GetPrimitiveType(CorElementType etype) {
			switch (etype) {
			case CorElementType.Void:		return appDomain.Void;
			case CorElementType.Boolean:	return appDomain.Boolean;
			case CorElementType.Char:		return appDomain.Char;
			case CorElementType.I1:			return appDomain.SByte;
			case CorElementType.U1:			return appDomain.Byte;
			case CorElementType.I2:			return appDomain.Int16;
			case CorElementType.U2:			return appDomain.UInt16;
			case CorElementType.I4:			return appDomain.Int32;
			case CorElementType.U4:			return appDomain.UInt32;
			case CorElementType.I8:			return appDomain.Int64;
			case CorElementType.U8:			return appDomain.UInt64;
			case CorElementType.R4:			return appDomain.Single;
			case CorElementType.R8:			return appDomain.Double;
			case CorElementType.String:		return appDomain.String;
			case CorElementType.TypedByRef:	return appDomain.TypedReference;
			case CorElementType.I:			return appDomain.IntPtr;
			case CorElementType.U:			return appDomain.UIntPtr;
			case CorElementType.Object:		return appDomain.Object;
			default: return null;
			}
		}
开发者ID:GreenDamTan,项目名称:dnSpy,代码行数:23,代码来源:Eval.cs

示例7: ParseIntegerConstant

		static ulong? ParseIntegerConstant(CorElementType etype, string c, out string error) {
			error = null;
			long smin, smax;
			ulong max;
			switch (etype) {
			case CorElementType.Boolean:
				smin = 0;
				smax = 1;
				max = 1;
				break;
			case CorElementType.I:
				if (IntPtr.Size == 4)
					goto case CorElementType.I4;
				goto case CorElementType.I8;
			case CorElementType.U:
			case CorElementType.Ptr:
			case CorElementType.FnPtr:
				if (UIntPtr.Size == 4)
					goto case CorElementType.U4;
				goto case CorElementType.U8;
			case CorElementType.I1:
			case CorElementType.U1:
				smin = sbyte.MinValue;
				smax = sbyte.MaxValue;
				max = byte.MaxValue;
				break;
			case CorElementType.I2:
			case CorElementType.U2:
				smin = short.MinValue;
				smax = short.MaxValue;
				max = ushort.MaxValue;
				break;
			case CorElementType.I4:
			case CorElementType.U4:
				smin = int.MinValue;
				smax = int.MaxValue;
				max = uint.MaxValue;
				break;
			case CorElementType.I8:
			case CorElementType.U8:
				smin = long.MinValue;
				smax = long.MaxValue;
				max = ulong.MaxValue;
				break;
			default:
				return null;
			}
			ulong v = NumberVMUtils.ParseUInt64(c, 0, max, out error);
			if (string.IsNullOrEmpty(error))
				return v;

			v = (ulong)NumberVMUtils.ParseInt64(c, smin, smax, out error);
			if (string.IsNullOrEmpty(error))
				return v;

			return null;
		}
开发者ID:GreenDamTan,项目名称:dnSpy,代码行数:57,代码来源:ValueStringParser.cs

示例8: Convert

		static byte[] Convert(CorElementType etype, object c) {
			var tc = c == null ? TypeCode.Empty : Type.GetTypeCode(c.GetType());
			switch (tc) {
			case TypeCode.Boolean:
				if (etype == CorElementType.Boolean)
					return new byte[1] { (byte)((bool)c ? 1 : 0) };
				return null;

			case TypeCode.Char:
				if (etype == CorElementType.Char)
					return BitConverter.GetBytes((char)c);
				return null;

			case TypeCode.SByte:
				if (etype == CorElementType.I1)
					return new byte[1] { (byte)(sbyte)c };
				return null;

			case TypeCode.Int16:
				if (etype == CorElementType.I2)
					return BitConverter.GetBytes((short)c);
				return null;

			case TypeCode.Int32:
				if (etype == CorElementType.I4)
					return BitConverter.GetBytes((int)c);
				return null;

			case TypeCode.Int64:
				if (etype == CorElementType.I8)
					return BitConverter.GetBytes((long)c);
				return null;

			case TypeCode.Byte:
				if (etype == CorElementType.U1)
					return new byte[1] { (byte)c };
				return null;

			case TypeCode.UInt16:
				if (etype == CorElementType.U2)
					return BitConverter.GetBytes((ushort)c);
				return null;

			case TypeCode.UInt32:
				if (etype == CorElementType.U4)
					return BitConverter.GetBytes((uint)c);
				return null;

			case TypeCode.UInt64:
				if (etype == CorElementType.U8)
					return BitConverter.GetBytes((ulong)c);
				return null;

			case TypeCode.Single:
				if (etype == CorElementType.R4)
					return BitConverter.GetBytes((float)c);
				return null;

			case TypeCode.Double:
				if (etype == CorElementType.R8)
					return BitConverter.GetBytes((double)c);
				return null;
			}

			return null;
		}
开发者ID:GreenDamTan,项目名称:dnSpy,代码行数:66,代码来源:ValueStringParser.cs

示例9: GetDefaultValue

 public void GetDefaultValue(int mdToken, out long value, out int length, out CorElementType corElementType)
 {
     int num;
     _GetDefaultValue(this.m_metadataImport2, out MetadataArgs.Skip, mdToken, out value, out length, out num);
     corElementType = (CorElementType) ((byte) num);
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:6,代码来源:MetadataImport.cs

示例10: ConvertUInt64

		static object ConvertUInt64(CorElementType etype, ulong v) {
			switch (etype) {
			case CorElementType.Boolean:
				return v != 0;
			case CorElementType.I:
				if (IntPtr.Size == 4)
					goto case CorElementType.I4;
				goto case CorElementType.I8;
			case CorElementType.I1:		return (sbyte)v;
			case CorElementType.I2:		return (short)v;
			case CorElementType.I4:		return (int)v;
			case CorElementType.I8:		return (long)v;
			case CorElementType.U:
				if (UIntPtr.Size == 4)
					goto case CorElementType.U4;
				goto case CorElementType.U8;
			case CorElementType.U1:		return (byte)v;
			case CorElementType.U2:		return (ushort)v;
			case CorElementType.U4:		return (uint)v;
			case CorElementType.U8:		return v;
			}
			return null;
		}
开发者ID:GreenDamTan,项目名称:dnSpy,代码行数:23,代码来源:ValueStringParser.cs

示例11: GetFieldConstant

		public unsafe static object GetFieldConstant(IMetaDataImport mdi, uint token, out CorElementType constantType) {
			constantType = CorElementType.End;
			if (mdi == null)
				return null;
			uint cchValue;
			IntPtr pValue;
			CorElementType constantTypeTmp;
			int hr = mdi.GetFieldProps(token, IntPtr.Zero, IntPtr.Zero, 0, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, new IntPtr(&constantTypeTmp), new IntPtr(&pValue), new IntPtr(&cchValue));
			if (hr < 0 || pValue == IntPtr.Zero)
				return null;
			constantType = constantTypeTmp;
			return ReadConstant(pValue, cchValue, constantType);
		}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:13,代码来源:MDAPI.cs

示例12: AddElementType

 private void AddElementType(CorElementType cvt)
 {
     if ((this.m_currSig + 1) > this.m_signature.Length)
     {
         this.m_signature = this.ExpandArray(this.m_signature);
     }
     this.m_signature[this.m_currSig++] = (byte) cvt;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:SignatureHelper.cs

示例13: AddElementType

        private void AddElementType(CorElementType cvt)
        {
            // Adds an element to the signature.  A managed represenation of CorSigCompressElement
            if (m_currSig + 1 > m_signature.Length) 
                m_signature = ExpandArray(m_signature);

            m_signature[m_currSig++] = (byte)cvt;
        }
开发者ID:kouvel,项目名称:coreclr,代码行数:8,代码来源:SignatureHelper.cs

示例14: UnsafeGetValueAsType

        public Object UnsafeGetValueAsType(CorElementType type)
        {
            switch(type)
            {
                case CorElementType.ELEMENT_TYPE_BOOLEAN:
                    byte bValue=4; // just initialize to avoid compiler warnings
                    unsafe
                    {
                        Debug.Assert(this.Size==sizeof(byte));
                        this.GetValueInternal(new IntPtr(&bValue));
                    }
                    return (object) (bValue!=0);

                case CorElementType.ELEMENT_TYPE_CHAR:
                    char cValue='a'; // initialize to avoid compiler warnings
                    unsafe
                    {
                        Debug.Assert(this.Size==sizeof(char));
                        this.GetValueInternal(new IntPtr(&cValue));
                    }
                    return (object) cValue;

                case CorElementType.ELEMENT_TYPE_I1:
                    SByte i1Value=4;
                    unsafe
                    {
                        Debug.Assert(this.Size==sizeof(SByte));
                        this.GetValueInternal(new IntPtr(&i1Value));
                    }
                    return (object) i1Value;

                case CorElementType.ELEMENT_TYPE_U1:
                    Byte u1Value=4;
                    unsafe
                    {
                        Debug.Assert(this.Size==sizeof(Byte));
                        this.GetValueInternal(new IntPtr(&u1Value));
                    }
                    return (object) u1Value;

                case CorElementType.ELEMENT_TYPE_I2:
                    Int16 i2Value=4;
                    unsafe
                    {
                        Debug.Assert(this.Size==sizeof(Int16));
                        this.GetValueInternal(new IntPtr(&i2Value));
                    }
                    return (object) i2Value;

                case CorElementType.ELEMENT_TYPE_U2:
                    UInt16 u2Value=4;
                    unsafe
                    {
                        Debug.Assert(this.Size==sizeof(UInt16));
                        this.GetValueInternal(new IntPtr(&u2Value));
                    }
                    return (object) u2Value;

                case CorElementType.ELEMENT_TYPE_I:
                    IntPtr ipValue=IntPtr.Zero;
                    unsafe
                    {
                        Debug.Assert(this.Size==sizeof(IntPtr));
                        this.GetValueInternal(new IntPtr(&ipValue));
                    }
                    return (object) ipValue;

                case CorElementType.ELEMENT_TYPE_U:
                    UIntPtr uipValue=UIntPtr.Zero;
                    unsafe
                    {
                        Debug.Assert(this.Size==sizeof(UIntPtr));
                        this.GetValueInternal(new IntPtr(&uipValue));
                    }
                    return (object) uipValue;

                case CorElementType.ELEMENT_TYPE_I4:
                    Int32 i4Value=4;
                    unsafe
                    {
                        Debug.Assert(this.Size==sizeof(Int32));
                        this.GetValueInternal(new IntPtr(&i4Value));
                    }
                    return (object) i4Value;

                case CorElementType.ELEMENT_TYPE_U4:
                    UInt32 u4Value=4;
                    unsafe
                    {
                        Debug.Assert(this.Size==sizeof(UInt32));
                        this.GetValueInternal(new IntPtr(&u4Value));
                    }
                    return (object) u4Value;

                case CorElementType.ELEMENT_TYPE_I8:
                    Int64 i8Value=4;
                    unsafe
                    {
                        Debug.Assert(this.Size==sizeof(Int64));
                        this.GetValueInternal(new IntPtr(&i8Value));
//.........这里部分代码省略.........
开发者ID:Gravecorp,项目名称:ipydbg,代码行数:101,代码来源:Value.cs

示例15: GetDefaultValue

 [System.Security.SecurityCritical]  // auto-generated
 public String GetDefaultValue(int mdToken, out long value, out int length, out CorElementType corElementType) 
 { 
     int _corElementType; 
     String stringVal;
     stringVal = _GetDefaultValue(m_metadataImport2, mdToken, out value, out length, out _corElementType); 
     corElementType = (CorElementType)_corElementType;
     return stringVal;
 }
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:9,代码来源:mdimport.cs


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