3

For example:

  • StudentRegistrationService<>c__DisplayClass1
  • <>f__AnonymousType56`2
  • DocShareClassification<GetErrors>d__2

I'm fairly certain that StudentRegistrationService<>c__DisplayClass1 is a closure, and <>f__AnonymousType56`2 was generated when an anonymous type was specified, but I've never seen the d__ class before. Are there any more than just these?

JaredPar
  • 733,204
  • 149
  • 1,241
  • 1,454
Jeremy Frey
  • 2,334
  • 2
  • 22
  • 26
  • Why would this matter? I mean, listing internal undocumented things that might change in any future release or service pack doesn't bring much value as we shouldn't rely on them anyways. – Darin Dimitrov Aug 18 '10 at 14:24
  • Curiosity. I'm seeing them in PartCover test coverage results, and wondering which (if any) are significant enough to include in coverage reports. – Jeremy Frey Aug 18 '10 at 14:51
  • @Jeremy, I would exclude any method which is tagged with the `CompilerGenerated` attribute. – JaredPar Aug 18 '10 at 14:55
  • 2
    This is a duplicate of http://stackoverflow.com/questions/2508828 - see my answer to that for details. – Eric Lippert Aug 18 '10 at 15:12
  • Thanks Eric, your answer there is exactly what I was looking for but couldn't figure what to search on – Jeremy Frey Aug 18 '10 at 15:27
  • possible duplicate of [Where to learn about VS debugger 'magic names'](http://stackoverflow.com/questions/2508828/where-to-learn-about-vs-debugger-magic-names) – Jeremy Frey Aug 18 '10 at 15:27

3 Answers3

6

These are classes which are generated by the C# compiler in order to support at least the following features

  • Closures / Anonymous Method expressions
  • Anonymous types
  • Iterators

The d__2 one is likely an iterator helping class.

JaredPar
  • 733,204
  • 149
  • 1,241
  • 1,454
1

That are at compile time generated classes created by using anonymous types

Wouter Janssens
  • 1,593
  • 10
  • 17
0

IIRC it is classes generated for iterator blocks. However you should make any assumptions about these names or rely on them - it is implementation details and may be changed in any time

desco
  • 16,642
  • 1
  • 45
  • 56