diff --git a/src/Eto.Serialization.Json/DefaultNamespaceManager.cs b/src/Eto.Serialization.Json/DefaultNamespaceManager.cs
index 110c422ec0..d08af447ff 100644
--- a/src/Eto.Serialization.Json/DefaultNamespaceManager.cs
+++ b/src/Eto.Serialization.Json/DefaultNamespaceManager.cs
@@ -4,7 +4,7 @@ public class DefaultNamespaceManager : NamespaceManager
{
public DefaultNamespaceManager ()
{
- var asm = typeof(Eto.Forms.Application).GetAssembly();
+ var asm = typeof(Eto.Forms.Application).Assembly;
DefaultNamespace = new NamespaceInfo("Eto.Forms", asm);
Namespaces.Add ("drawing", new NamespaceInfo("Eto.Drawing", asm));
}
diff --git a/src/Eto.Serialization.Json/Eto.Serialization.Json.csproj b/src/Eto.Serialization.Json/Eto.Serialization.Json.csproj
index ecadda5da9..c79a13a5f3 100644
--- a/src/Eto.Serialization.Json/Eto.Serialization.Json.csproj
+++ b/src/Eto.Serialization.Json/Eto.Serialization.Json.csproj
@@ -19,7 +19,6 @@ https://github.com/picoe/Eto/wiki
-
diff --git a/src/Eto.Serialization.Json/JsonReader.cs b/src/Eto.Serialization.Json/JsonReader.cs
index 4e2859d641..0c6f262108 100644
--- a/src/Eto.Serialization.Json/JsonReader.cs
+++ b/src/Eto.Serialization.Json/JsonReader.cs
@@ -11,7 +11,7 @@ static Stream GetStream(Type type)
GetStream(type, type.FullName + ".jeto")
?? GetStream(type, type.FullName + ".json")
?? GetStream(type, type.Name + ".jeto") // for f# projects
- ?? throw new InvalidOperationException($"Embedded resource '{type.FullName}.jeto' not found in assembly '{type.GetAssembly()}'");
+ ?? throw new InvalidOperationException($"Embedded resource '{type.FullName}.jeto' not found in assembly '{type.Assembly}'");
}
static Stream GetStream(Type type, string resourceName)
@@ -106,7 +106,7 @@ public static void Load(T instance, string resourceName, NamespaceManager nam
using (var stream = GetStream(typeof(T), resourceName))
{
if (stream == null)
- throw new ArgumentException(nameof(resourceName), $"Embedded resource '{resourceName}' not found in assembly '{typeof(T).GetAssembly()}'");
+ throw new ArgumentException(nameof(resourceName), $"Embedded resource '{resourceName}' not found in assembly '{typeof(T).Assembly}'");
Load(stream, instance, namespaceManager);
}
diff --git a/src/Eto.Serialization.Xaml/Eto.Serialization.Xaml.csproj b/src/Eto.Serialization.Xaml/Eto.Serialization.Xaml.csproj
index 4e8da49fe4..a6e0cf6759 100644
--- a/src/Eto.Serialization.Xaml/Eto.Serialization.Xaml.csproj
+++ b/src/Eto.Serialization.Xaml/Eto.Serialization.Xaml.csproj
@@ -19,7 +19,6 @@ https://github.com/picoe/Eto/wiki
-
diff --git a/src/Eto.Serialization.Xaml/XamlReader.cs b/src/Eto.Serialization.Xaml/XamlReader.cs
index cd7bfca50a..0a33c5972d 100644
--- a/src/Eto.Serialization.Xaml/XamlReader.cs
+++ b/src/Eto.Serialization.Xaml/XamlReader.cs
@@ -27,12 +27,12 @@ static Stream GetStream(Type type)
GetStream(type, type.FullName + ".xeto")
?? GetStream(type, type.FullName + ".xaml")
?? GetStream(type, type.Name + ".xeto") // for F#/VB.NET projects
- ?? throw new InvalidOperationException($"Embedded resource '{type.FullName}.xeto' not found in assembly '{type.GetAssembly()}'");
+ ?? throw new InvalidOperationException($"Embedded resource '{type.FullName}.xeto' not found in assembly '{type.Assembly}'");
}
static Stream GetStream(Type type, string resourceName)
{
- return type.GetAssembly().GetManifestResourceStream(resourceName);
+ return type.Assembly.GetManifestResourceStream(resourceName);
}
///
@@ -115,7 +115,7 @@ public static void Load(T instance, string resourceName)
using (var stream = GetStream(typeof(T), resourceName))
{
if (stream == null)
- throw new ArgumentException(nameof(resourceName), $"Embedded resource '{resourceName}' not found in assembly '{typeof(T).GetAssembly()}'");
+ throw new ArgumentException(nameof(resourceName), $"Embedded resource '{resourceName}' not found in assembly '{typeof(T).Assembly}'");
Load(stream, instance);
}
@@ -146,7 +146,7 @@ public static T Load(Stream stream, T instance)
{
var readerSettings = new XamlXmlReaderSettings();
if (!DesignMode)
- readerSettings.LocalAssembly = typeof(T).GetAssembly();
+ readerSettings.LocalAssembly = typeof(T).Assembly;
return Load(new XamlXmlReader(stream, context, readerSettings), instance);
}
@@ -161,7 +161,7 @@ public static T Load(TextReader reader, T instance)
{
var readerSettings = new XamlXmlReaderSettings();
if (!DesignMode)
- readerSettings.LocalAssembly = typeof(T).GetAssembly();
+ readerSettings.LocalAssembly = typeof(T).Assembly;
return Load(new XamlXmlReader(reader, context, readerSettings), instance);
}
@@ -176,7 +176,7 @@ public static T Load(XmlReader reader, T instance)
{
var readerSettings = new XamlXmlReaderSettings();
if (!DesignMode)
- readerSettings.LocalAssembly = typeof(T).GetAssembly();
+ readerSettings.LocalAssembly = typeof(T).Assembly;
return Load(new XamlXmlReader(reader, context, readerSettings), instance);
}
diff --git a/src/Eto/DefaultStyleProvider.cs b/src/Eto/DefaultStyleProvider.cs
index c26f85e9e2..66999bca1f 100644
--- a/src/Eto/DefaultStyleProvider.cs
+++ b/src/Eto/DefaultStyleProvider.cs
@@ -114,7 +114,7 @@ IList> GetCascadingStyleList(Type type)
if (styleMap.TryGetValue(currentType, out var typeStyles) && typeStyles != null)
styleHandlers = typeStyles.Concat(styleHandlers);
}
- while ((currentType = currentType.GetBaseType()) != null);
+ while ((currentType = currentType.BaseType) != null);
// create a cached list, but if its empty don't store it
childHandlers = styleHandlers.ToList();
diff --git a/src/Eto/Drawing/Bitmap.cs b/src/Eto/Drawing/Bitmap.cs
index c54a5db20d..9e797a8c40 100644
--- a/src/Eto/Drawing/Bitmap.cs
+++ b/src/Eto/Drawing/Bitmap.cs
@@ -108,7 +108,7 @@ public static Bitmap FromResource(string resourceName, Type type)
{
if (type == null)
throw new ArgumentNullException("type");
- return FromResource(resourceName, type.GetAssembly());
+ return FromResource(resourceName, type.Assembly);
}
///
diff --git a/src/Eto/Drawing/Icon.cs b/src/Eto/Drawing/Icon.cs
index 8099912d05..0b02103568 100644
--- a/src/Eto/Drawing/Icon.cs
+++ b/src/Eto/Drawing/Icon.cs
@@ -176,7 +176,7 @@ public static Icon FromResource(string resourceName, Type type)
{
if (type == null)
throw new ArgumentNullException("type");
- return FromResource(resourceName, type.GetAssembly());
+ return FromResource(resourceName, type.Assembly);
}
///
diff --git a/src/Eto/EventLookup.cs b/src/Eto/EventLookup.cs
index 78eca9b5e7..226e239a78 100644
--- a/src/Eto/EventLookup.cs
+++ b/src/Eto/EventLookup.cs
@@ -3,7 +3,7 @@ namespace Eto;
static class EventLookup
{
static readonly Dictionary> registeredEvents = new Dictionary>();
- static readonly Assembly etoAssembly = typeof(EventLookup).GetAssembly();
+ static readonly Assembly etoAssembly = typeof(EventLookup).Assembly;
static readonly Dictionary externalEvents = new Dictionary();
struct EventDeclaration
@@ -29,7 +29,7 @@ public static void HookupEvents(Widget widget)
{
var type = widget.GetType();
- if (type.GetAssembly() == etoAssembly)
+ if (type.Assembly == etoAssembly)
return;
if (widget.Handler is Widget.IHandler handler)
@@ -46,7 +46,7 @@ public static bool IsDefault(Widget widget, string identifier)
{
var type = widget.GetType();
- if (type.GetAssembly() == etoAssembly)
+ if (type.Assembly == etoAssembly)
return false;
var events = GetEvents(type);
return Array.IndexOf(events, identifier) >= 0;
@@ -68,14 +68,14 @@ static IEnumerable FindTypeEvents(Type type)
var current = type;
while (current != null)
{
- if (current.GetAssembly() == etoAssembly)
+ if (current.Assembly == etoAssembly)
{
if (registeredEvents.TryGetValue(current, out var declarations))
{
for (int i = 0; i < externalTypes.Count; i++)
{
var externalType = externalTypes[i];
- foreach (var method in externalType.GetTypeInfo().DeclaredMethods)
+ foreach (var method in externalType.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.DeclaredOnly))
{
for (int j = 0; j < declarations.Count; j++)
{
@@ -91,7 +91,7 @@ static IEnumerable FindTypeEvents(Type type)
{
externalTypes.Add(current);
}
- current = current.GetBaseType();
+ current = current.BaseType;
}
}
diff --git a/src/Eto/Forms/Binding/BindingExtensionsNonGeneric.cs b/src/Eto/Forms/Binding/BindingExtensionsNonGeneric.cs
index d97b9bfea1..531846fb52 100644
--- a/src/Eto/Forms/Binding/BindingExtensionsNonGeneric.cs
+++ b/src/Eto/Forms/Binding/BindingExtensionsNonGeneric.cs
@@ -24,7 +24,7 @@ static PropertyInfo GetFirstDeclaredProperty(Type type, string propertyName)
var property = type.GetTypeInfo().GetDeclaredProperty(propertyName);
if (property != null)
return property;
- type = type.GetBaseType();
+ type = type.BaseType;
}
return null;
}
diff --git a/src/Eto/Forms/Binding/IndirectBinding.cs b/src/Eto/Forms/Binding/IndirectBinding.cs
index 0d92836c57..32a08e5389 100644
--- a/src/Eto/Forms/Binding/IndirectBinding.cs
+++ b/src/Eto/Forms/Binding/IndirectBinding.cs
@@ -379,7 +379,7 @@ public IndirectBinding Child(IndirectBinding bi
public IndirectBinding EnumToString(T defaultValue = default(T))
{
var enumType = Nullable.GetUnderlyingType(typeof(T)) ?? typeof(T);
- if (!enumType.IsEnum())
+ if (!enumType.IsEnum)
throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Type of T ({0}) must be an enumeration type", typeof(T)));
return new DelegateBinding