Don't create new empty arrays
This commit is contained in:
committed by
Sebastiaan Janssen
parent
6f8749bc52
commit
67e812d93c
@@ -11,6 +11,7 @@ namespace Umbraco.Web.PublishedCache.NuCache.DataSource
|
||||
/// </summary>
|
||||
internal class DictionaryOfPropertyDataSerializer : SerializerBase, ISerializer<IDictionary<string, PropertyData[]>>, IDictionaryOfPropertyDataSerializer
|
||||
{
|
||||
private static readonly PropertyData[] Empty = Array.Empty<PropertyData>();
|
||||
public IDictionary<string, PropertyData[]> ReadFrom(Stream stream)
|
||||
{
|
||||
// read properties count
|
||||
@@ -25,6 +26,11 @@ namespace Umbraco.Web.PublishedCache.NuCache.DataSource
|
||||
|
||||
// read values count
|
||||
var vcount = PrimitiveSerializer.Int32.ReadFrom(stream);
|
||||
if(vcount == 0)
|
||||
{
|
||||
dict[key] = Empty;
|
||||
continue;
|
||||
}
|
||||
|
||||
// create pdata and add to the dictionary
|
||||
var pdatas = new PropertyData[vcount];
|
||||
|
||||
Reference in New Issue
Block a user