Home > C#, Mirror Mirror > MirrorMirror: Methods support/Api Improvements

MirrorMirror: Methods support/Api Improvements

MirrorMirror now supports methods! The only restriction is the method can’t have more than 8 or 9 parameters (for void methods). This is because of the DynamicMethod working as a delegate and the need to have each Action and Func signature. Anyway, who needs 10 arguments in a method?

Also, I improved the API so you have only 3 main methods:

  • Get: Retrieves the value of the given fields and properties chain
  • Set: Sets the values of the field or property with the given name
  • Invoke: Ivokes the method with the given name that matches the given arguments
var name = person.Get<string>("Name");
person.Set("Name", "Ivo Wiblo");

var name = person.Get<string>("_name");
person.Set("_name", "Ivo Wiblo");

var name = person.Invoke<string>("GetName");
person.Invoke("SetName", "Ivo Wiblo");

var countryName = address.Get("City._country.Name");
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: