|
1 | 1 | #nullable enable
|
2 | 2 |
|
3 | 3 | using System;
|
4 |
| -using Uno.UI.DataBinding; |
5 |
| -using System.Collections.Generic; |
6 |
| -using Uno.Extensions; |
7 |
| -using Uno.Foundation.Logging; |
8 |
| -using Uno.Diagnostics.Eventing; |
9 |
| -using Uno.Disposables; |
10 |
| -using System.Linq; |
11 |
| -using System.Threading; |
12 | 4 | using Uno.Collections;
|
13 |
| -using System.Runtime.CompilerServices; |
14 |
| -using System.Diagnostics; |
15 |
| -using Microsoft.UI.Xaml.Data; |
16 |
| -using Uno.UI; |
17 |
| -using System.Collections; |
18 |
| - |
19 |
| -#if __ANDROID__ |
20 |
| -using View = Android.Views.View; |
21 |
| -#elif __IOS__ |
22 |
| -using View = UIKit.UIView; |
23 |
| -#endif |
24 |
| - |
25 |
| -namespace Microsoft.UI.Xaml |
| 5 | + |
| 6 | +namespace Microsoft.UI.Xaml; |
| 7 | + |
| 8 | +public partial class DependencyObjectStore : IDisposable |
26 | 9 | {
|
27 |
| - public partial class DependencyObjectStore : IDisposable |
| 10 | + private readonly struct AncestorsDictionary |
28 | 11 | {
|
29 |
| - private class AncestorsDictionary |
| 12 | + private readonly HashtableEx _entries = new HashtableEx(); |
| 13 | + |
| 14 | + // Constructor to avoid: |
| 15 | + // error CS8983: A 'struct' with field initializers must include an explicitly declared constructor. |
| 16 | + public AncestorsDictionary() |
30 | 17 | {
|
31 |
| - private readonly HashtableEx _entries = new HashtableEx(); |
| 18 | + } |
32 | 19 |
|
33 |
| - internal bool TryGetValue(object key, out bool isAncestor) |
| 20 | + internal bool TryGetValue(object key, out bool isAncestor) |
| 21 | + { |
| 22 | + if (_entries.TryGetValue(key, out var value)) |
34 | 23 | {
|
35 |
| - if (_entries.TryGetValue(key, out var value)) |
36 |
| - { |
37 |
| - isAncestor = (bool)value!; |
38 |
| - return true; |
39 |
| - } |
40 |
| - |
41 |
| - isAncestor = false; |
42 |
| - return false; |
| 24 | + isAncestor = (bool)value!; |
| 25 | + return true; |
43 | 26 | }
|
44 | 27 |
|
45 |
| - internal void Set(object key, bool isAncestor) |
46 |
| - => _entries[key] = isAncestor; |
| 28 | + isAncestor = false; |
| 29 | + return false; |
| 30 | + } |
| 31 | + |
| 32 | + internal void Set(object key, bool isAncestor) |
| 33 | + => _entries[key] = isAncestor; |
47 | 34 |
|
48 |
| - internal void Clear() |
49 |
| - => _entries.Clear(); |
| 35 | + internal void Clear() |
| 36 | + => _entries.Clear(); |
50 | 37 |
|
51 |
| - internal void Dispose() |
52 |
| - => _entries.Dispose(); |
53 |
| - } |
| 38 | + internal void Dispose() |
| 39 | + => _entries.Dispose(); |
54 | 40 | }
|
55 | 41 | }
|
0 commit comments