|
|
|
@ -96,7 +96,7 @@ namespace Google.ProtocolBuffers |
|
|
|
|
{ |
|
|
|
|
private static readonly ExtensionRegistry empty = new ExtensionRegistry( |
|
|
|
|
new ExtensionByNameMap(), |
|
|
|
|
new ExtensionByIdMap(), |
|
|
|
|
new ExtensionByIdMap(new ExtensionIntPairEqualityComparer()), |
|
|
|
|
true); |
|
|
|
|
|
|
|
|
|
private readonly ExtensionByNameMap extensionsByName; |
|
|
|
@ -116,7 +116,7 @@ namespace Google.ProtocolBuffers |
|
|
|
|
/// </summary> |
|
|
|
|
public static ExtensionRegistry CreateInstance() |
|
|
|
|
{ |
|
|
|
|
return new ExtensionRegistry(new ExtensionByNameMap(), new ExtensionByIdMap(), false); |
|
|
|
|
return new ExtensionRegistry(new ExtensionByNameMap(), new ExtensionByIdMap(new ExtensionIntPairEqualityComparer()), false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public ExtensionRegistry AsReadOnly() |
|
|
|
@ -216,5 +216,17 @@ namespace Google.ProtocolBuffers |
|
|
|
|
return msgType.Equals(other.msgType) && number == other.number; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
internal class ExtensionIntPairEqualityComparer : IEqualityComparer<ExtensionIntPair> |
|
|
|
|
{ |
|
|
|
|
public bool Equals(ExtensionIntPair x, ExtensionIntPair y) |
|
|
|
|
{ |
|
|
|
|
return x.Equals(y); |
|
|
|
|
} |
|
|
|
|
public int GetHashCode(ExtensionIntPair obj) |
|
|
|
|
{ |
|
|
|
|
return obj.GetHashCode(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |