Skip to content

Commit 1943465

Browse files
StefHCopilot
andauthored
Update src/System.Linq.Dynamic.Core/DynamicGetMemberBinder.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 6d96775 commit 1943465

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/System.Linq.Dynamic.Core/DynamicGetMemberBinder.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,14 @@ namespace System.Linq.Dynamic.Core;
1515
internal class DynamicGetMemberBinder : GetMemberBinder
1616
{
1717
private static readonly MethodInfo DynamicGetMemberMethod = typeof(DynamicGetMemberBinder).GetMethod(nameof(GetDynamicMember))!;
18+
19+
// The _metaObjectCache uses a Tuple<Type, string, bool> as the key to cache DynamicMetaObject instances.
20+
// The key components are:
21+
// - Type: The LimitType of the target object, ensuring type-specific caching.
22+
// - string: The member name being accessed.
23+
// - bool: The IgnoreCase flag, indicating whether the member name comparison is case-insensitive.
24+
// This strategy ensures that the cache correctly handles different types, member names, and case-sensitivity settings.
1825
private readonly ConcurrentDictionary<Tuple<Type, string, bool>, DynamicMetaObject> _metaObjectCache = new();
19-
2026
internal DynamicGetMemberBinder(string name, ParsingConfig? config) : base(name, config?.IsCaseSensitive != true)
2127
{
2228
}

0 commit comments

Comments
 (0)