reduce array allocations
This commit is contained in:
committed by
Sebastiaan Janssen
parent
b5546d074a
commit
32788a0a42
@@ -33,15 +33,16 @@ namespace Umbraco.Web.PublishedCache.NuCache
|
||||
_urlSegment = ContentData.UrlSegment;
|
||||
IsPreviewing = ContentData.Published == false;
|
||||
|
||||
var properties = new List<IPublishedProperty>();
|
||||
var properties = new IPublishedProperty[_contentNode.ContentType.PropertyTypes.Count()];
|
||||
int i =0;
|
||||
foreach (var propertyType in _contentNode.ContentType.PropertyTypes)
|
||||
{
|
||||
// add one property per property type - this is required, for the indexing to work
|
||||
// if contentData supplies pdatas, use them, else use null
|
||||
contentData.Properties.TryGetValue(propertyType.Alias, out var pdatas); // else will be null
|
||||
properties.Add(new Property(propertyType, this, pdatas, _publishedSnapshotAccessor));
|
||||
properties[i++] =new Property(propertyType, this, pdatas, _publishedSnapshotAccessor);
|
||||
}
|
||||
PropertiesArray = properties.ToArray();
|
||||
PropertiesArray = properties;
|
||||
}
|
||||
|
||||
private string GetProfileNameById(int id)
|
||||
|
||||
Reference in New Issue
Block a user