Improve performance of calling ICustomTypeDescriptor.GetProperties
This commit is contained in:
committed by
James Newton-King
parent
9f405a45ad
commit
7f113ff49a
@@ -744,13 +744,15 @@ namespace Newtonsoft.Json.Linq
|
||||
|
||||
PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties(Attribute[] attributes)
|
||||
{
|
||||
PropertyDescriptorCollection descriptors = new PropertyDescriptorCollection(null);
|
||||
|
||||
var propertiesArray = new PropertyDescriptor[Count];
|
||||
var i = 0;
|
||||
foreach (KeyValuePair<string, JToken?> propertyValue in this)
|
||||
{
|
||||
descriptors.Add(new JPropertyDescriptor(propertyValue.Key));
|
||||
propertiesArray[i] = new JPropertyDescriptor(propertyValue.Key);
|
||||
i++;
|
||||
}
|
||||
|
||||
var descriptors = new PropertyDescriptorCollection(propertiesArray);
|
||||
return descriptors;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user