Modifica

Condividi tramite


ARReferenceObject.EncodeTo(NSCoder) Method

Definition

Encodes the state of the object on the provided encoder

[Foundation.Export("encodeWithCoder:")]
public virtual void EncodeTo (Foundation.NSCoder encoder);
abstract member EncodeTo : Foundation.NSCoder -> unit
override this.EncodeTo : Foundation.NSCoder -> unit

Parameters

encoder
NSCoder

The encoder object where the state of the object will be stored

Implements

Attributes

Remarks

This method is part of the NSCoding protocol and is used by applications to preserve the state of the object into an archive.

Users will typically create a NSKeyedArchiver and then invoke the ArchiveRootObjectToFile(NSObject, String) which will call into this method

If developers want to allow their object to be archived, they should override this method and store their state in using the provided encoder parameter. In addition, developers should also implement a constructor that takes an NSCoder argument and is exported with [Export ("initWithCoder:")]

public void override EncodeTo (NSCoder coder){
    coder.Encode (1, key: "version");
    coder.Encode (userName, key: "userName");
    coder.Encode (hostName, key: "hostName");

Applies to