views:

66

answers:

3

Possible Duplicate:
What is the maximum length of a C#/CLI identifier?

When generating dynamic assemblies and types, what is length restriction on the type name?

+1  A: 

There doesn't appear to be one (that thread is about method name length, but it really applies to your question as well).

dcp
+2  A: 

I tested this in C#, and there is a limitation on the class names in the compiler, even if there is no limitation in the CLI.

If you declare a class name that is 511 characters, it works. If you use 512 characters you get the compiler error "Identifier too long".

Guffa
+3  A: 

From Ecma-335, page 103:

Metadata preserves name strings, as created by a compiler or code generator, unchanged. Essentially, it treats each string as an opaque blob. In particular, it preserves case. The CLI imposes no limit on the length of names stored in metadata and subsequently processed by the CLI.

sduplooy