public static object GetObject(Type type, string key = "") { if (type == null) { throw new ArgumentNullException(nameof(type)); } if (type.IsAbstract || type.IsSubclassOf(typeof(Object))) { throw new ArgumentException("Cannot deserialize to new instances of type '" + type.Name + ".'"); } return(RemoteSettings.GetAsScriptingObject(type, (object)null, key)); }
public static object GetObject(string key, object defaultValue) { if (defaultValue == null) { throw new ArgumentNullException(nameof(defaultValue)); } Type type = defaultValue.GetType(); if (type.IsAbstract || type.IsSubclassOf(typeof(Object))) { throw new ArgumentException("Cannot deserialize to new instances of type '" + type.Name + ".'"); } return(RemoteSettings.GetAsScriptingObject(type, defaultValue, key)); }