Explorar o código

Merge pull request #3493 from MarchingCube/refactor-type-info-bulk

Remove TypeInfo usage from multiple projects.
Jumar Macato %!s(int64=5) %!d(string=hai) anos
pai
achega
a2307244ab

+ 1 - 2
src/Avalonia.Interactivity/RoutedEvent.cs

@@ -3,7 +3,6 @@
 
 using System;
 using System.Reactive.Subjects;
-using System.Reflection;
 
 namespace Avalonia.Interactivity
 {
@@ -29,7 +28,7 @@ namespace Avalonia.Interactivity
             Contract.Requires<ArgumentNullException>(name != null);
             Contract.Requires<ArgumentNullException>(eventArgsType != null);
             Contract.Requires<ArgumentNullException>(ownerType != null);
-            Contract.Requires<InvalidCastException>(typeof(RoutedEventArgs).GetTypeInfo().IsAssignableFrom(eventArgsType.GetTypeInfo()));
+            Contract.Requires<InvalidCastException>(typeof(RoutedEventArgs).IsAssignableFrom(eventArgsType));
 
             EventArgsType = eventArgsType;
             Name = name;

+ 1 - 3
src/Avalonia.ReactiveUI/AvaloniaActivationForViewFetcher.cs

@@ -2,9 +2,7 @@
 // Licensed under the MIT license. See licence.md file in the project root for full license information.
 
 using System;
-using System.Reflection;
 using System.Reactive.Linq;
-using Avalonia;
 using Avalonia.VisualTree;
 using Avalonia.Controls;
 using ReactiveUI;
@@ -21,7 +19,7 @@ namespace Avalonia.ReactiveUI
         /// </summary>
         public int GetAffinityForView(Type view)
         {
-            return typeof(IVisual).GetTypeInfo().IsAssignableFrom(view.GetTypeInfo()) ? 10 : 0;
+            return typeof(IVisual).IsAssignableFrom(view) ? 10 : 0;
         }
 
         /// <summary>

+ 1 - 3
src/Avalonia.Visuals/VisualTree/VisualLocator.cs

@@ -1,7 +1,5 @@
 using System;
 using System.Linq;
-using System.Reactive.Linq;
-using System.Reflection;
 using Avalonia.Reactive;
 
 namespace Avalonia.VisualTree
@@ -50,7 +48,7 @@ namespace Avalonia.VisualTree
                 if (_relativeTo.IsAttachedToVisualTree)
                 {
                     return _relativeTo.GetVisualAncestors()
-                        .Where(x => _ancestorType?.GetTypeInfo().IsAssignableFrom(x.GetType().GetTypeInfo()) ?? true)
+                        .Where(x => _ancestorType?.IsAssignableFrom(x.GetType()) ?? true)
                         .ElementAtOrDefault(_ancestorLevel);
                 }
                 else

+ 1 - 2
src/Markup/Avalonia.Markup.Xaml/Templates/DataTemplate.cs

@@ -2,7 +2,6 @@
 // Licensed under the MIT license. See licence.md file in the project root for full license information.
 
 using System;
-using System.Reflection;
 using Avalonia.Controls;
 using Avalonia.Controls.Templates;
 using Avalonia.Metadata;
@@ -28,7 +27,7 @@ namespace Avalonia.Markup.Xaml.Templates
             }
             else
             {
-                return DataType.GetTypeInfo().IsAssignableFrom(data.GetType().GetTypeInfo());
+                return DataType.IsInstanceOfType(data);
             }
         }
 

+ 1 - 4
src/Markup/Avalonia.Markup.Xaml/Templates/TreeDataTemplate.cs

@@ -2,12 +2,9 @@
 // Licensed under the MIT license. See licence.md file in the project root for full license information.
 
 using System;
-using System.Reflection;
 using Avalonia.Controls;
 using Avalonia.Controls.Templates;
 using Avalonia.Data;
-using Avalonia.Data.Core;
-using Avalonia.Markup.Data;
 using Avalonia.Markup.Parsers;
 using Avalonia.Metadata;
 
@@ -34,7 +31,7 @@ namespace Avalonia.Markup.Xaml.Templates
             }
             else
             {
-                return DataType.GetTypeInfo().IsAssignableFrom(data.GetType().GetTypeInfo());
+                return DataType.IsInstanceOfType(data);
             }
         }