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


C# IMetaDataImport.GetPropertyProps方法代码示例

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


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

示例1: GetPropertyConstant

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

示例2: GetPropertyAttributes

		public unsafe static PropertyAttributes GetPropertyAttributes(IMetaDataImport mdi, uint token) {
			if (mdi == null)
				return 0;
			uint dwPropFlags;
			int hr = mdi.GetPropertyProps(token, IntPtr.Zero, IntPtr.Zero, 0, IntPtr.Zero, new IntPtr(&dwPropFlags), IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, 0, IntPtr.Zero);
			return hr == 0 ? (PropertyAttributes)dwPropFlags : 0;
		}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:7,代码来源:MDAPI.cs

示例3: GetPropertySignatureBlob

		public unsafe static byte[] GetPropertySignatureBlob(IMetaDataImport mdi, uint token) {
			if (mdi == null)
				return null;
			IntPtr pvSig;
			uint cbSig;
			int hr = mdi.GetPropertyProps(token, IntPtr.Zero, IntPtr.Zero, 0, IntPtr.Zero, IntPtr.Zero, new IntPtr(&pvSig), new IntPtr(&cbSig), IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, 0, IntPtr.Zero);
			if (hr != 0)
				return null;

			var data = new byte[cbSig];
			Marshal.Copy(pvSig, data, 0, data.Length);
			return data;
		}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:13,代码来源:MDAPI.cs

示例4: GetPropertyOtherMethodTokens

		public unsafe static uint[] GetPropertyOtherMethodTokens(IMetaDataImport mdi, uint token) {
			uint count;
			int hr = mdi.GetPropertyProps(token, IntPtr.Zero, IntPtr.Zero, 0, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, 0, new IntPtr(&count));
			uint[] tokens = null;
			if (hr >= 0 && count != 0) {
				tokens = new uint[count];
				fixed (uint* p = &tokens[0])
					hr = mdi.GetPropertyProps(token, IntPtr.Zero, IntPtr.Zero, 0, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, new IntPtr(p), (uint)tokens.Length, new IntPtr(&count));
			}
			if (hr < 0)
				return new uint[0];
			return tokens ?? new uint[0];
		}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:13,代码来源:MDAPI.cs

示例5: GetPropertyGetterSetter

		public unsafe static bool GetPropertyGetterSetter(IMetaDataImport mdi, uint token, out uint mdGetter, out uint mdSetter) {
			mdGetter = 0;
			mdSetter = 0;
			if (mdi == null)
				return false;
			uint mdSetterTmp, mdGetterTmp;
			int hr = mdi.GetPropertyProps(token, IntPtr.Zero, IntPtr.Zero, 0, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, new IntPtr(&mdSetterTmp), new IntPtr(&mdGetterTmp), IntPtr.Zero, 0, IntPtr.Zero);
			if (hr != 0)
				return false;
			mdSetter = mdSetterTmp;
			mdGetter = mdGetterTmp;
			return true;
		}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:13,代码来源:MDAPI.cs

示例6: GetPropertyName

		public unsafe static string GetPropertyName(IMetaDataImport mdi, uint token) {
			uint chProperty;
			int hr = mdi.GetPropertyProps(token, IntPtr.Zero, IntPtr.Zero, 0, new IntPtr(&chProperty), IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, 0, IntPtr.Zero);
			char[] nameBuf = null;
			if (hr >= 0 && chProperty != 0) {
				nameBuf = new char[chProperty];
				fixed (char* p = &nameBuf[0])
					hr = mdi.GetPropertyProps(token, IntPtr.Zero, new IntPtr(p), (uint)nameBuf.Length, new IntPtr(&chProperty), IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, 0, IntPtr.Zero);
			}
			if (hr < 0)
				return null;

			return chProperty <= 1 ? string.Empty : new string(nameBuf, 0, (int)chProperty - 1);
		}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:14,代码来源:MDAPI.cs

示例7: GetPropertyOwnerRid

		public unsafe static uint GetPropertyOwnerRid(IMetaDataImport mdi, uint token) {
			if (mdi == null)
				return 0;
			if (IsGlobal(mdi, token))
				return 1;
			uint ownerToken;
			int hr = mdi.GetPropertyProps(token, new IntPtr(&ownerToken), IntPtr.Zero, 0, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, 0, IntPtr.Zero);
			if (hr != 0)
				return 0;
			var ownerMdToken = new MDToken(ownerToken);
			return ownerMdToken.Table == Table.TypeDef ? ownerMdToken.Rid : 0;
		}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:12,代码来源:MDAPI.cs

示例8: ReadPropertyInfo

		unsafe static CorPropertyInfo ReadPropertyInfo(IMetaDataImport mdi, uint token, CorType type) {
			if (mdi == null)
				return null;

			uint chProperty, dwPropFlags, mdSetter, mdGetter;
			int hr = mdi.GetPropertyProps(token, IntPtr.Zero, IntPtr.Zero, 0, out chProperty, out dwPropFlags, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, out mdSetter, out mdGetter, IntPtr.Zero, 0, IntPtr.Zero);
			char[] nameBuf = null;
			if (hr >= 0 && chProperty != 0) {
				nameBuf = new char[chProperty];
				fixed (char* p = &nameBuf[0])
					hr = mdi.GetPropertyProps(token, IntPtr.Zero, new IntPtr(p), (uint)nameBuf.Length, out chProperty, out dwPropFlags, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, out mdSetter, out mdGetter, IntPtr.Zero, 0, IntPtr.Zero);
			}
			if (hr < 0)
				return null;

			string name = chProperty <= 1 ? string.Empty : new string(nameBuf, 0, (int)chProperty - 1);

			var getSig = GetMethodSignature(mdi, mdGetter);
			var setSig = GetMethodSignature(mdi, mdSetter);

			if (getSig == null)
				return null;
			if (getSig.ParamsAfterSentinel != null)
				return null;
			if (getSig.GenParamCount != 0)
				return null;
			if (getSig.Params.Count != 0)
				return null;
			if (getSig.RetType.RemovePinnedAndModifiers().GetElementType() == ElementType.Void)
				return null;

			if (setSig != null && setSig.ParamsAfterSentinel != null)
				setSig = null;
			if (setSig != null && setSig.GenParamCount != 0)
				setSig = null;
			if (setSig != null && setSig.Params.Count != 1)
				setSig = null;
			if (setSig != null && setSig.RetType.RemovePinnedAndModifiers().GetElementType() != ElementType.Void)
				setSig = null;

			if (setSig != null && getSig.HasThis != setSig.HasThis)
				setSig = null;
			if (setSig != null && !Equals(getSig.RetType.RemovePinnedAndModifiers(), setSig.Params[0].RemovePinnedAndModifiers()))
				setSig = null;

			if (setSig == null)
				mdSetter = 0;

			MethodAttributes getMethodAttrs;
			MethodImplAttributes dwImplAttrs;
			IntPtr pvSigBlob;
			hr = mdi.GetMethodProps(mdGetter, IntPtr.Zero, IntPtr.Zero, 0, out chProperty, out getMethodAttrs, out pvSigBlob, out chProperty, out chProperty, out dwImplAttrs);
			if (hr < 0)
				return null;

			var browseState = GetDebuggerBrowsableState(mdi, token);

			return new CorPropertyInfo(type, token, mdGetter, mdSetter, name, getSig, setSig, getMethodAttrs, browseState);
		}
开发者ID:nakijun,项目名称:dnSpy,代码行数:59,代码来源:MetaDataUtils.cs


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