Update, I recommend also reading the following post after you read this one if you plan on using this within .Net 4: http://www.lacy.ie/updating-redirection-using-strong-types-to-net-4 It recently began to annoy me that every time I want to redirect to a page I have to use a string. Not a big deal I know but when you have broken [...]
I find mocking the http context rather difficult, you can’t inherit from it and making a wrapper class is a lot of work. Thankfully someone came up with a solution, unfortunately the link they included with the code is dead and I can’t seem to remember where I got the code, if anyone finds out [...]
Taken from http://www.galcho.com/Blog/P… Here is how to call a method with an out parameter using MethodInfo.Invoke, in this case the out parameter is the last one (int). int parNum = 0; string parText = “99″; object[] methodParms = new object[] { parText, parNum }; MethodInfo methInfo = parNum.GetType().GetMethod(“TryParse”, new Type[] { typeof(string), typeof(int).MakeByRefType() }); methInfo.Invoke(null, [...]
I’ve recently started moving a large amount of code on the project I’m working on from the presentation layer into a business logic layer. One of the problems I found was trying to link to other pages on the site without know where the application would be located or if it would be http or [...]
Say you have an outer method: public OuterMethod(object x) { InnerMethod(x); } and an inner method with these overloads public InnerMethod(object x) { //Generic Actions } public InnerMethod(Person x) { //Person Specific Actions } public InnerMethod(Dog x) { // Dog Specific Actions } How do you make it so that when the outer method calls [...]