What is the maximum length of a type name in .NET.

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

When creating dynamic assemblies and types, what is the length constraint on the type name?

+2


a source to share


3 answers


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



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

+5


a source


From Ecma-335, p. 103:



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

+3


a source


There does not appear any one (the flow refers to the length of the name of the method, but it really applies to your question).

+1


a source







All Articles