diff --git a/src/Foundation/NSKeyedArchiver.cs b/src/Foundation/NSKeyedArchiver.cs index 695d77d4d86c..de4090899664 100644 --- a/src/Foundation/NSKeyedArchiver.cs +++ b/src/Foundation/NSKeyedArchiver.cs @@ -22,23 +22,20 @@ // using CoreFoundation; -// Disable until we get around to enable + fix any issues. -#nullable disable +#nullable enable namespace Foundation { public partial class NSKeyedArchiver { - /// To be added. - /// To be added. - /// To be added. - /// To be added. + /// Sets the global class name for a specified class. + /// The class name to use during archiving. + /// The to associate with the name. + /// This method associates a class name with a class for all instances of . Use to set the class name for a specific archiver instance. public static void GlobalSetClassName (string name, Class kls) { - if (name is null) - ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (name)); - if (kls is null) - ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (kls)); + ArgumentNullException.ThrowIfNull (name); + ArgumentNullException.ThrowIfNull (kls); var ptr = CFString.CreateNative (name); ObjCRuntime.Messaging.void_objc_msgSend_IntPtr_IntPtr (class_ptr, Selector.GetHandle ("setClassName:forClass:"), ptr, kls.Handle); @@ -46,16 +43,15 @@ public static void GlobalSetClassName (string name, Class kls) CFString.ReleaseNative (ptr); } - /// To be added. - /// To be added. - /// To be added. - /// To be added. - public static string GlobalGetClassName (Class kls) + /// Gets the global class name for a specified class. + /// The to query. + /// The class name associated with the class, or if no class name has been set. + /// This method retrieves the class name associated with a class for all instances of . Use to get the class name for a specific archiver instance. + public static string? GlobalGetClassName (Class kls) { - if (kls is null) - ObjCRuntime.ThrowHelper.ThrowArgumentNullException (nameof (kls)); + ArgumentNullException.ThrowIfNull (kls); - string result = CFString.FromHandle (ObjCRuntime.Messaging.IntPtr_objc_msgSend_IntPtr (class_ptr, Selector.GetHandle ("classNameForClass:"), kls.Handle)); + string? result = CFString.FromHandle (ObjCRuntime.Messaging.IntPtr_objc_msgSend_IntPtr (class_ptr, Selector.GetHandle ("classNameForClass:"), kls.Handle)); GC.KeepAlive (kls); return result; }