diff --git a/src/Smdn.Net.EchonetLite.Appendix/Smdn.Net.EchonetLite.Appendix/EchonetObjectSpecification.cs b/src/Smdn.Net.EchonetLite.Appendix/Smdn.Net.EchonetLite.Appendix/EchonetObjectSpecification.cs index e28af97..650f8f5 100644 --- a/src/Smdn.Net.EchonetLite.Appendix/Smdn.Net.EchonetLite.Appendix/EchonetObjectSpecification.cs +++ b/src/Smdn.Net.EchonetLite.Appendix/Smdn.Net.EchonetLite.Appendix/EchonetObjectSpecification.cs @@ -41,7 +41,9 @@ internal EchonetObjectSpecification(byte classGroupCode, byte classCode) SpecificationMaster.GetInstance().DeviceClasses.FirstOrDefault(p => p.Code == classGroupCode) ?? throw new ArgumentException($"unknown class group: 0x{classGroupCode:X2}"); - var properties = new List(); + const int MaxNumberOfProperty = 0x80; // EPC: 0b_1XXX_XXXX (0x80~0xFF) + + var properties = new List(capacity: MaxNumberOfProperty); //スーパークラスのプロパティを列挙 using (var stream = SpecificationMaster.GetSpecificationMasterDataStream($"{ClassGroup.SuperClassName}.json")) @@ -69,6 +71,8 @@ internal EchonetObjectSpecification(byte classGroupCode, byte classCode) } } + properties.TrimExcess(); // reduce capacity + Properties = properties; }