Foundation.NSObject.SetValueForKeyPath Method
Sets the value of a property that can be reached using a keypath.

Syntax

[Foundation.Export("setValue:forKeyPath:")]
public virtual void SetValueForKeyPath (NSObject value, NSString keyPath)

Parameters

value
Value to set on the property.
keyPath
Key-path to use to perform the value lookup. The keypath consists of a series of lowercase ASCII-strings with no spaces in them separated by dot characters.

Remarks

The keypath is separated by dots, and each component is used to lookup a specific key on the object. The process is repeated on each returning object until the last element is processed.

If a component of the key path is not found, the method NSObject.SetValueForUndefinedKey(NSObject, NSString) is invoked, and its default implementation raises an Objective-C exception. Subclasses can alter this behavior by overriding that method.

c# Example

string SetMobilePhone (Order order, NSString phone)
{
	return order.SetValueForKeyPath ("user.address.phone.mobile", phone);
}

Requirements

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