DmdType[] CreateGenericParameters_COMThread() { reader.Dispatcher.VerifyAccess(); var tokens = MDAPI.GetGenericParamTokens(reader.MetaDataImport, (uint)MetadataToken); if (tokens.Length == 0) { return(null); } var genericParams = new DmdType[tokens.Length]; for (int i = 0; i < genericParams.Length; i++) { uint token = tokens[i]; uint rid = token & 0x00FFFFFF; var gpName = MDAPI.GetGenericParamName(reader.MetaDataImport, token) ?? string.Empty; if (!MDAPI.GetGenericParamNumAndAttrs(reader.MetaDataImport, token, out var gpNumber, out var gpAttrs)) { return(null); } var gpType = new DmdGenericParameterTypeCOMD(reader, rid, this, gpName, gpNumber, gpAttrs, null); genericParams[i] = gpType; } return(genericParams); }
void InitGenericParamProps_NoLock() { var mdi2 = readerModule.MetaDataImport2; uint token = OriginalToken.Raw; Name = MDAPI.GetGenericParamName(mdi2, token) ?? string.Empty; Kind = null; MDAPI.GetGenericParamNumAndAttrs(mdi2, token, out number, out var attrs); attributes = (int)attrs; }
public static List <TokenAndName> GetGenericParameterNames(IMetaDataImport mdi, uint token) { var gpTokens = MDAPI.GetGenericParamTokens(mdi as IMetaDataImport2, token); var list = new List <TokenAndName>(gpTokens.Length); var mdi2 = mdi as IMetaDataImport2; if (mdi2 == null) { return(list); } foreach (var gpTok in gpTokens) { var name = MDAPI.GetGenericParamName(mdi as IMetaDataImport2, gpTok); list.Add(new TokenAndName(name ?? string.Empty, gpTok)); } return(list); }