Today I just rocked.
-
var meth = binder.BindToMethod(BindingFlags.InvokeMethod | BindingFlags.NonPublic | BindingFlags.Static, binder.GetMethodGroup(
code.Namespaces[1].Types[0],
"Bar",
BindingFlags.NonPublic | BindingFlags.Static),
ref args, null, System.Globalization.CultureInfo.CurrentCulture,null);
Console.WriteLine(CodeDomUtility.ToString(meth));I implemented reflection binding over CodeDOM objects as though they were real types. I even support the #)(%*@)#%
BindingFlags
enumeration Above is just calling the stupid thing. You should see what the code to make it work looks like. What it does: say in your codedom you haveclass Foo
{
public int Bar(string foo)
{
Console.WriteLine(foo);
return foo.GetHashCode();
}
public string Bar(int foo)
{
Console.WriteLine(foo);
return foo.ToString();
}
}Based on a group of methods with the same name, and a set of arguments or types you give it, match the signature to what you passed in, and return the appropriate method that best matches the signature, including doing widening conversions on primitive types, and skipping type checking on null arguments. This is H-A-R-D But I did it. Woo. Does it for indexed properties as well. Gosh I never want to have to implement a binder again.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
-
var meth = binder.BindToMethod(BindingFlags.InvokeMethod | BindingFlags.NonPublic | BindingFlags.Static, binder.GetMethodGroup(
code.Namespaces[1].Types[0],
"Bar",
BindingFlags.NonPublic | BindingFlags.Static),
ref args, null, System.Globalization.CultureInfo.CurrentCulture,null);
Console.WriteLine(CodeDomUtility.ToString(meth));I implemented reflection binding over CodeDOM objects as though they were real types. I even support the #)(%*@)#%
BindingFlags
enumeration Above is just calling the stupid thing. You should see what the code to make it work looks like. What it does: say in your codedom you haveclass Foo
{
public int Bar(string foo)
{
Console.WriteLine(foo);
return foo.GetHashCode();
}
public string Bar(int foo)
{
Console.WriteLine(foo);
return foo.ToString();
}
}Based on a group of methods with the same name, and a set of arguments or types you give it, match the signature to what you passed in, and return the appropriate method that best matches the signature, including doing widening conversions on primitive types, and skipping type checking on null arguments. This is H-A-R-D But I did it. Woo. Does it for indexed properties as well. Gosh I never want to have to implement a binder again.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
honey the codewitch wrote:
var meth = binder
so, you're cooking, erm, coding meth ?
I'd rather be phishing!
-
honey the codewitch wrote:
var meth = binder
so, you're cooking, erm, coding meth ?
I'd rather be phishing!
That's not even the worst of them. I've used
die
as short for delegate-invoke-expression recently. I've usedf-c
at least once that i can recall,p-s
probably dozens more. :laugh: edited for forum rulesWhen I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
-
That's not even the worst of them. I've used
die
as short for delegate-invoke-expression recently. I've usedf-c
at least once that i can recall,p-s
probably dozens more. :laugh: edited for forum rulesWhen I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
I'm still impressed that someone at Microsoft managed to slip both
PIDL
andSHITEMID
past their corporate overlords. :) Common Explorer Concepts (Windows) | Microsoft Docs[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
I'm still impressed that someone at Microsoft managed to slip both
PIDL
andSHITEMID
past their corporate overlords. :) Common Explorer Concepts (Windows) | Microsoft Docs[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
haha and I'm such a microsoftie i didn't even think anything of PIDL until you just said something.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.