diff --git a/common.props b/common.props
index a7a9984..f38de64 100644
--- a/common.props
+++ b/common.props
@@ -7,7 +7,7 @@
10.0.19041.41
- 1.0.9
+ 1.0.9
ar_128.png
en
https://github.com/AndreasReitberger/MauiSettings
diff --git a/src/MauiSettings/Attributes/MauiSettingBaseAttribute.cs b/src/MauiSettings/Attributes/MauiSettingBaseAttribute.cs
index 8918227..238d264 100644
--- a/src/MauiSettings/Attributes/MauiSettingBaseAttribute.cs
+++ b/src/MauiSettings/Attributes/MauiSettingBaseAttribute.cs
@@ -11,10 +11,10 @@
public class MauiSettingBaseAttribute : Attribute
{
#region Properties
- public string Name { get; set; }
+ public string Name { get; set; } = string.Empty;
- private object _default;
- public object DefaultValue
+ private object? _default;
+ public object? DefaultValue
{
get
{
diff --git a/src/MauiSettings/Helper/MauiSettingsHelper.cs b/src/MauiSettings/Helper/MauiSettingsHelper.cs
index e131266..6e04bf6 100644
--- a/src/MauiSettings/Helper/MauiSettingsHelper.cs
+++ b/src/MauiSettings/Helper/MauiSettingsHelper.cs
@@ -69,11 +69,11 @@ internal class MauiSettingsHelper
SetSettingsValue(key, defaultValue);
return defaultValue;
}
- return ChangeSettingsType(returnValue, defaultValue);
+ return ChangeSettingsType(returnValue, defaultValue);
//return (T)Convert.ChangeType(returnValue, typeof(T));
}
- public static T? ChangeSettingsType(object settingsValue, T defaultValue) => (T)Convert.ChangeType(settingsValue, typeof(T)) ?? default;
+ public static T? ChangeSettingsType(object? settingsValue, T defaultValue) => settingsValue is not null ? (T)Convert.ChangeType(settingsValue, typeof(T)) : default;
// Docs: https://docs.microsoft.com/en-us/dotnet/maui/platform-integration/storage/secure-storage?tabs=ios
// Only string is allowed for secure storage
diff --git a/src/MauiSettings/Helper/MauiSettingsInfo.cs b/src/MauiSettings/Helper/MauiSettingsInfo.cs
index 4edf04a..b45c62a 100644
--- a/src/MauiSettings/Helper/MauiSettingsInfo.cs
+++ b/src/MauiSettings/Helper/MauiSettingsInfo.cs
@@ -10,10 +10,10 @@
internal class MauiSettingsInfo
{
#region Properties
- public string Name { get; set; }
- public object Value { get; set; }
- public Type SettingsType { get; set; }
- public object Default { get; set; }
+ public string Name { get; set; } = string.Empty;
+ public object? Value { get; set; }
+ public Type? SettingsType { get; set; }
+ public object? Default { get; set; }
public bool IsSecure { get; set; } = false;
public bool Encrypt { get; set; } = false;
public bool SkipForExport { get; set; } = false;
diff --git a/src/MauiSettings/Helper/MauiSettingsObjectHelper.cs b/src/MauiSettings/Helper/MauiSettingsObjectHelper.cs
index d7b3a14..b625c52 100644
--- a/src/MauiSettings/Helper/MauiSettingsObjectHelper.cs
+++ b/src/MauiSettings/Helper/MauiSettingsObjectHelper.cs
@@ -14,7 +14,7 @@ namespace AndreasReitberger.Maui.Helper
internal class MauiSettingsObjectHelper
{
- public static object GetSettingValue(MemberInfo mi, object o)
+ public static object? GetSettingValue(MemberInfo mi, object o)
{
if (mi is FieldInfo fieldInfo)
{
@@ -24,10 +24,10 @@ public static object GetSettingValue(MemberInfo mi, object o)
{
return propertyInfo.GetValue(o);
}
- return (mi as PropertyInfo)?.GetMethod.Invoke(o, Array.Empty