Added FieldDescriptor.IsExtension and sealed ExtensionCollection

This commit is contained in:
Sydney Acksman 2019-03-23 14:57:02 -05:00
parent 8b7fb7d0f4
commit 8e917d1688
2 changed files with 6 additions and 1 deletions

View File

@ -39,7 +39,7 @@ namespace Google.Protobuf.Reflection
/// <summary>
/// A collection to simplify retrieving the descriptors of extensions in a descriptor for a message
/// </summary>
public class ExtensionCollection
public sealed class ExtensionCollection
{
private IDictionary<MessageDescriptor, IList<FieldDescriptor>> extensionsByTypeInDeclarationOrder;
private IDictionary<MessageDescriptor, IList<FieldDescriptor>> extensionsByTypeInNumberOrder;

View File

@ -203,6 +203,11 @@ namespace Google.Protobuf.Reflection
/// </summary>
public bool IsPacked => File.Proto.Syntax == "proto2" ? Proto.Options?.Packed ?? false : !Proto.Options.HasPacked || Proto.Options.Packed;
/// <summary>
/// Returns <c>true</c> if this field extends another message type; <c>false</c> otherwise.
/// </summary>
public bool IsExtension => Proto.HasExtendee;
/// <summary>
/// Returns the type of the field.
/// </summary>