And by trick, I mean I was too slow to realize that: someDictionary.Add(“Hi”, (Boolean doThis) => SomeMethod(doThis)); Can be done this way: someDictionary.Add(“Hi”, SomeMethod); Where the dictionary is: Dictionary<String, Action<Bool>> someDictionary; someDictionary = new Dictionary<String, Action<Bool>>(); And SomeMethod is: void SomeMethod(Boolean doSomething) { //Something is to be done! } Which as far as I know, [...]
I’m starting to worry about myself
So the “dynamic” linq query so far isn’t just enough to stop. Oh no, now that I can have methods pass back expressions, what about a dictionary of order by expressions to allow an even more dynamic feel? Huh? How’s about that kids? I hate myself too. //Enum created for the dictionary key public enum [...]
And some days I love programming
This is the newest edition of Linq madness. So I added an OrderBy to my lame dynamic query thing. private static IQueryable<User> GetUserList(Expression<Func<User, Boolean>> whereClause, Expression<Func<User, String>> orderBy) { var query = (from user in GetDataContext().Users select user).Where(whereClause).OrderBy(orderBy); return query; } Now you will notice there is a new Expression in town and it’s name [...]
I likz demz linq
So today I had this weird need to try creating a sort of dynamic linq thing in which I could query a User list but not have to write a Linq query for every method. I just wanted to make a method that would return the correct query that I wanted based on a simple [...]
I ain’t gettin’ paid enough for this…
Remember when I said I’m not exactly great with programming terms? Well if I didn’t, I am saying it now. So I saw the word “closures” today and had no idea what this was. All excited about something new, I found out that closures is just another word for anonymous methods, although it may include [...]