Foundation.NSExpression.EncodeTo Method
Encodes the state of the object on the provided encoder

Syntax

[Foundation.Export("encodeWithCoder:")]
public virtual void EncodeTo (NSCoder encoder)

Parameters

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

Remarks

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

Users will typically create a Foundation.NSKeyedArchived and then invoke the NSKeyedArchived.ArchiveRootObjectToFile which will call into this method

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

c# Example

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

Requirements

Namespace: Foundation
Assembly: Xamarin.iOS (in Xamarin.iOS.dll)
Assembly Versions: 0.0.0.0