Home > C#, Mirror Mirror, software design > MirrorMirror: Working on the generics API

MirrorMirror: Working on the generics API

Yesterday I finished the basic invokation API for MirrorMirror. Now I want it to start supporting generic methods. Since the current API uses params object[] for the parameters, I don’t know how to add the type parameters to that. I want to avoid the usage of generics in the API, because several times you will be dealing with internal types, so you can’t add them as a type parameter.

One idea I have is to change the current, simple API:

var result = object.Invoke("Method", arg1, arg2);


var result = object.Member("Method").Invoke(arg1, arg2);

so I can add method to that chain to support generics:

var result = object.Member("Method").Generic( type1, type2).Invoke(arg1, arg2);

Following this schema, I can always give support to the first API, but it will only work for non generic methods.
Also I would like to add support to generic types inference, so if you have a method with this signature:

private string MyGenericMethod<T1,T2>( T1 a, T2 b)

you can call it without specify the type parameters.

I will be working on this in the following days and will post the final thoughts.

  1. praveen
    June 22, 2010 at 5:32 pm

    you should be posting about NHibernate 🙂

    • ivowiblo
      June 22, 2010 at 8:56 pm

      pretty soon, my friend. pretty soon.

  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: