/// <summary>
/// Reads a single property signature at the current position of the provided stream reader.
/// </summary>
/// <param name="image">The image the signature resides in.</param>
/// <param name="reader">The reader to use.</param>
/// <param name="readToEnd">Determines whether any extra data after the signature should be read and
/// put into the <see cref="ExtendableBlobSignature.ExtraData"/> property.</param>
/// <param name="protection">The recursion protection that is used to detect malicious loops in the metadata.</param>
/// <returns>The read signature.</returns>
public new static PropertySignature FromReader(
MetadataImage image,
IBinaryStreamReader reader,
bool readToEnd,
RecursionProtection protection)
{
var signature = new PropertySignature
{
Attributes = (CallingConventionAttributes)reader.ReadByte(),
};
if (!reader.TryReadCompressedUInt32(out uint paramCount))
{
return(null);
}
signature.PropertyType = TypeSignature.FromReader(image, reader, false, protection);
for (int i = 0; i < paramCount; i++)
{
signature.Parameters.Add(ParameterSignature.FromReader(image, reader, protection));
}
if (readToEnd)
{
signature.ExtraData = reader.ReadToEnd();
}
return(signature);
}