/// <summary> /// Reads the specified token. /// </summary> /// <param name="token">The token.</param> /// <param name="result">The result.</param> public void Read(TokenTypes token, out MethodSpecRow result) { if ((token & TokenTypes.TableMask) != TokenTypes.MethodSpec) { throw new ArgumentException("Invalid token type for MethodSpecRow.", "token"); } using (BinaryReader reader = CreateReaderForToken(token)) { result = new MethodSpecRow(ReadIndexValue(reader, IndexType.MethodDefOrRef), ReadIndexValue(reader, IndexType.BlobHeap)); } }
public GenericInstanceMethod GetMethodSpecAt(uint rid, GenericContext context) { int index = (int)rid - 1; GenericInstanceMethod gim = m_methodSpecs [index]; if (gim != null) { return(gim); } MethodSpecTable msTable = m_tableReader.GetMethodSpecTable(); MethodSpecRow msRow = msTable [index]; MethodSpec sig = m_sigReader.GetMethodSpec(msRow.Instantiation); MethodReference meth; if (msRow.Method.TokenType == TokenType.Method) { meth = GetMethodDefAt(msRow.Method.RID); } else if (msRow.Method.TokenType == TokenType.MemberRef) { meth = (MethodReference)GetMemberRefAt(msRow.Method.RID, context); } else { throw new ReflectionException("Unknown method type for method spec"); } gim = new GenericInstanceMethod(meth); foreach (SigType st in sig.Signature.Types) { gim.GenericArguments.Add(GetTypeRefFromSig(st, context)); } m_methodSpecs [index] = gim; return(gim); }
public virtual void VisitMethodSpecRow(MethodSpecRow row) { }
void IMetadataProvider.Read(TokenTypes token, out MethodSpecRow result) { TableHeap theap = (TableHeap)_streams[(int)HeapType.Tables]; theap.Read(token, out result); }