-
Notifications
You must be signed in to change notification settings - Fork 743
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: FrameworkProperties for type performance
- Loading branch information
1 parent
8b88c0b
commit 366d36e
Showing
2 changed files
with
45 additions
and
1 deletion.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
src/Uno.UI/UI/Xaml/DependencyProperty.Dictionary.FrameworkPropertiesForType.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#nullable enable | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using Windows.UI.Xaml; | ||
using Uno.Extensions; | ||
using System.Diagnostics; | ||
using System.Runtime.CompilerServices; | ||
using Uno; | ||
using System.Threading; | ||
using Uno.Collections; | ||
|
||
using _Key = Uno.CachedTuple<System.Type, Windows.UI.Xaml.FrameworkPropertyMetadataOptions>; | ||
|
||
namespace Windows.UI.Xaml | ||
{ | ||
public sealed partial class DependencyProperty | ||
{ | ||
private class FrameworkPropertiesForTypeDictionary | ||
{ | ||
private readonly HashtableEx _entries = new HashtableEx(); | ||
|
||
internal bool TryGetValue(_Key key, out DependencyProperty[]? result) | ||
{ | ||
if (_entries.TryGetValue(key, out var value)) | ||
{ | ||
result = (DependencyProperty[])value!; | ||
|
||
return true; | ||
} | ||
|
||
result = null; | ||
return false; | ||
} | ||
|
||
internal void Add(_Key key, DependencyProperty[] value) | ||
=> _entries.Add(key, value); | ||
|
||
internal void Clear() => _entries.Clear(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters