本文整理汇总了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);
}
示例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;
}
示例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;
}
示例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];
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}