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

Syntax

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

Parameters

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

Remarks

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

Users will typically create a MonoTouch.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: MonoTouch.Foundation
Assembly: monotouch (in monotouch.dll)
Assembly Versions: 0.0.0.0