diff --git a/AyCode.Core/Serializers/Binaries/BinaryPropertyAccessorBase.cs b/AyCode.Core/Serializers/Binaries/BinaryPropertyAccessorBase.cs index 15c653c..b68b09a 100644 --- a/AyCode.Core/Serializers/Binaries/BinaryPropertyAccessorBase.cs +++ b/AyCode.Core/Serializers/Binaries/BinaryPropertyAccessorBase.cs @@ -7,7 +7,7 @@ namespace AyCode.Core.Serializers.Binaries; /// /// Binary-specific property accessor. /// Inherits typed getters from PropertyAccessorBase. -/// Adds Binary-specific property: PropertyIndex. +/// Adds Binary-specific properties: PropertyIndex, IsStringInternProperty. /// public abstract class BinaryPropertyAccessorBase : PropertyAccessorBase { @@ -18,14 +18,26 @@ public abstract class BinaryPropertyAccessorBase : PropertyAccessorBase /// public int PropertyIndex { get; internal set; } = -1; + /// + /// Cached string intern attribute value for this property. + /// null = no attribute (use global StringInterningMode setting) + /// true = [AcStringIntern(true)] - always intern + /// false = [AcStringIntern(false)] - never intern + /// + public bool? IsStringInternProperty { get; } + /// /// Object getter for property filter context. /// public Func DynamicGetter => _dynamicGetter; - protected BinaryPropertyAccessorBase(PropertyInfo prop, Type declaringType) + protected BinaryPropertyAccessorBase(PropertyInfo prop, Type declaringType) : base(prop, declaringType) { // All typed getters are initialized in PropertyAccessorBase + + // Cache string intern attribute (inherit: true to check base class properties) + var attr = prop.GetCustomAttribute(inherit: true); + IsStringInternProperty = attr?.Enabled; } }