implement helper function to get property value as a specific type

This commit is contained in:
Michael Becker 2019-11-23 21:15:52 -05:00
parent d6e08850e2
commit 0e0e176111
No known key found for this signature in database
GPG Key ID: 389DFF5D73781A12

View File

@ -354,5 +354,15 @@ namespace UniversalEditor.ObjectModels.FileSystem
bw.Flush();
return count;
}
public T GetProperty<T>(string name, T defaultValue = default(T))
{
if (Properties.ContainsKey(name))
{
if (Properties[name] is T)
return (T)Properties[name];
}
return defaultValue;
}
}
}