Get/Set Values for Instance Fields and Properties

Get/Set Values for Instance Fields and Properties

To set or get values of instance fields and properties, get or create an instance of the .NET object, and call “get(fieldOrPropertyName)” or “set(fieldOrPropertyName,newValue)” methods on NObject containing this field.

Example

//Your .NET class
	public class JavonetSample
	{
		public int MyInstanceField { get; set; }
	}
//Usage in Java
	NObject sampleObj = Javonet.New("JavonetSample");
	sampleObj.set("MyInstanceField", 10);
	Integer val = sampleObj.get("MyInstanceField");

See Live Example!