Click here to Skip to main content
15,900,724 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: I get docked for style a lot when I code, but look at Microsoft's reference source Pin
honey the codewitch9-Dec-19 21:45
mvahoney the codewitch9-Dec-19 21:45 
GeneralRe: I get docked for style a lot when I code, but look at Microsoft's reference source Pin
Marc Clifton10-Dec-19 2:20
mvaMarc Clifton10-Dec-19 2:20 
GeneralRe: I get docked for style a lot when I code, but look at Microsoft's reference source Pin
honey the codewitch10-Dec-19 2:25
mvahoney the codewitch10-Dec-19 2:25 
GeneralRe: I get docked for style a lot when I code, but look at Microsoft's reference source Pin
den2k8810-Dec-19 3:05
professionalden2k8810-Dec-19 3:05 
GeneralRe: I get docked for style a lot when I code, but look at Microsoft's reference source Pin
Chris Maunder10-Dec-19 4:33
cofounderChris Maunder10-Dec-19 4:33 
GeneralRe: I get docked for style a lot when I code, but look at Microsoft's reference source Pin
honey the codewitch10-Dec-19 4:36
mvahoney the codewitch10-Dec-19 4:36 
GeneralRe: I get docked for style a lot when I code, but look at Microsoft's reference source Pin
dandy7210-Dec-19 5:29
dandy7210-Dec-19 5:29 
GeneralToday I just rocked. Pin
honey the codewitch9-Dec-19 14:45
mvahoney the codewitch9-Dec-19 14:45 
C#
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 have
C#
class 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.

GeneralRe: Today I just rocked. Pin
Maximilien9-Dec-19 15:10
Maximilien9-Dec-19 15:10 
GeneralRe: Today I just rocked. Pin
honey the codewitch9-Dec-19 15:14
mvahoney the codewitch9-Dec-19 15:14 
GeneralRe: Today I just rocked. Pin
Richard Deeming11-Dec-19 1:23
mveRichard Deeming11-Dec-19 1:23 
GeneralRe: Today I just rocked. Pin
honey the codewitch11-Dec-19 2:10
mvahoney the codewitch11-Dec-19 2:10 
GeneralToday was a very good day PinPopular
Sander Rossel9-Dec-19 7:40
professionalSander Rossel9-Dec-19 7:40 
PraiseRe: Today was a very good day Pin
RickZeeland9-Dec-19 7:48
mveRickZeeland9-Dec-19 7:48 
GeneralRe: Today was a very good day Pin
Cp-Coder9-Dec-19 8:50
Cp-Coder9-Dec-19 8:50 
GeneralRe: Today was a very good day Pin
RickZeeland9-Dec-19 8:54
mveRickZeeland9-Dec-19 8:54 
GeneralRe: Today was a very good day Pin
Cp-Coder9-Dec-19 9:07
Cp-Coder9-Dec-19 9:07 
GeneralRe: Today was a very good day Pin
Rick York9-Dec-19 11:29
mveRick York9-Dec-19 11:29 
GeneralRe: Today was a very good day Pin
Cp-Coder9-Dec-19 12:30
Cp-Coder9-Dec-19 12:30 
GeneralRe: Today was a very good day Pin
Sander Rossel9-Dec-19 21:39
professionalSander Rossel9-Dec-19 21:39 
GeneralRe: Today was a very good day Pin
RickZeeland9-Dec-19 9:09
mveRickZeeland9-Dec-19 9:09 
GeneralRe: Today was a very good day Pin
PIEBALDconsult9-Dec-19 8:28
mvePIEBALDconsult9-Dec-19 8:28 
GeneralRe: Today was a very good day Pin
Sander Rossel9-Dec-19 21:41
professionalSander Rossel9-Dec-19 21:41 
GeneralRe: Today was a very good day Pin
Ravi Bhavnani9-Dec-19 9:37
professionalRavi Bhavnani9-Dec-19 9:37 
GeneralRe: Today was a very good day Pin
RickZeeland9-Dec-19 10:06
mveRickZeeland9-Dec-19 10:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Straw Poll

Were you affected by the geomagnetic storms this past weekend?
Communication disruptions, electrified pipes, random unexplained blue-screens in Windows - the list of effects is terrifying.
  Results   494 votes