3 ms·
I've never once used the dynamic keyword in a C# program, but I do ponder on it a lot. The new dynamic features in C# being able to provide a "method_missing" a
by city41 16y ago
I've never once used the dynamic keyword in a C# program, but I do ponder on it a lot. The new dynamic features in C# being able to provide a "method_missing" along with the emphasis on "what it does" over "what it is" is really intriguing to me. Can this be leveraged in any meaningful way in C#? Has anyone given it a real try yet? If so, should we even bother? Why not just stick with a language like Ruby then? It feels awkward to say the least to start doing this in a language like C#. Although most C# apps dive into reflection quite a bit to pull off similar functionality.
I am currently working on a Silverlight app using RIA Services. Here on the server side you have to have each CRUD method for each type you are surfacing. You can't do
public IQueryable<T> Get<T>() { }
It has to be
public IQueryable<Foo> GetFoos() { }
public IQueryable<Bar> GetBars() { }
Same with all update, insert and delete methods. It drives me insane that I literally have several thousand lines of CRUD methods. Can some kind of dynamic solution jump in here and help? I doubt it, but I can dream. (Generics don't work here because RIA services can't support sending generic arguments across the wire).
- jules 16y agoThat depends on what the GetFoos are doing. Why couldn't you do IQueryable<ISerializable>?