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.
I hope so. It gets instantiated a lot. I use it during code dom visitation, on any "marked" expression I need to "patch"
Basically, I'm using the CodeDOM as my abstract syntax tree to hold the results of my parse.
But without type information applied to it the tree is ambiguous. That is,
Could be a delegate invocation of field baz, or a delegate invocation of property baz.
foo could be a variable, a method argument, a type (where bar is a static field), an instance field, etc.
So for you to even know what to compile from this parse, you need to apply type information from the tree.
The CodeDOM has different objects for reference fields, properties, methods and events, plus arguments and variables. So when I parse, i plug the tree with "dummies" - foo is always treated as a variable until it's patched. xxx(...) always refers to a delegate invocation until it's patched.
While I patch, I "visit" each object in the CodeDOM tree, and look for these dummies I inserted. When I find one, I "get scope" which returns one of the monsters the partial code for is above.
I then use that data to match it against the names of each of the dummies I inserted - to see what's a field and what's a method and what's a property, and what's a type, etc. I then use this information to fixup the tree with the appropriate objects, creating compilable code.
Not much different than what the C# compiler does internally.
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.
I've been in the biz for over 40 years, you have a ways to go before you eclipse my "code nobody uses" amount.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013