Longest & Shortest Types in .NET
Junfeng Zhang asks what is the longest class name in .NET. I threw together a quick little .NET class digger and found that:
From the assemblies located at: “..\v1.1.4322\System*.dll"
C:\WINNT\Microsoft.NET\Framework\v1.1.4322\System.Windows.Forms.dll
Contains the type:
UpDownBase+UpDownButtons+UpDownButtonsAccessibleObject+DirectionButtonAccessibleObject
which is 86 characters long.
The shortest:
C:\WINNT\Microsoft.NET\Framework\v1.1.4322\System.Design.dll
Contains:
System.Design.SR
which is, of course, a length of 2
EDIT:
To add, the longest PUBLIC class is:
System.Windows.Forms.IDataGridColumnStyleEditingNotificationService
with a length of 46
4 Comments
Comments have been disabled for this content.
Junfeng Zhang said
Thanks for the quick dig.
Yes, not out of my expectation.
Mark Hurd said
Note to your EDIT: System.GC is the shortest public class name.
Using DotLisp and my extra.lisp patch: (Not all system assemblies loaded)
> (for-each-type t (when (and t.IsPublic (<= t.Name.Length 3)) (prns t.FullName)))
System.GC
System.Security.Cryptography.DES
System.Security.Cryptography.DSA
System.Security.Cryptography.MD5
System.Security.Cryptography.RC2
System.Security.Cryptography.RSA
System.Security.Policy.Url
System.Uri
System.Net.Dns
System.Windows.Forms.Day
System.Drawing.Pen
> (for-each-type t (when (and t.IsPublic (>= t.Name.Length 39)) (prns t.FullName)))
System.Security.Cryptography.CryptographicUnexpectedOperationException
System.Security.Policy.ApplicationDirectoryMembershipCondition
System.CodeDom.CodeParameterDeclarationExpressionCollection
System.CodeDom.CodePropertySetValueReferenceExpression
System.ComponentModel.DesignerSerializationVisibilityAttribute
System.Diagnostics.PerformanceCounterPermissionEntryCollection
System.Windows.Forms.IDataGridColumnStyleEditingNotificationService
System.Windows.Forms.DataGridPreferredColumnWidthTypeConverter
System.Xml.Serialization.XmlSerializationCollectionFixupCallback
>
Mark Hurd said
David Flanagan: If you're looking at full names for PUBLIC classes
System.GC
is shortest at 9, and
System.Windows.Forms.ComponentModel.Com2Interop.ICom2PropertyPageDisplayService
is longest at 79.
Again, using DotLisp:
> (for-each-type t (when (and t.IsPublic (<= t.FullName.Length 11)) (prns t.FullName)))
System.Enum
System.Byte
System.Char
System.GC
System.Guid
System.Math
System.Type
System.Void
System.Uri
> (for-each-type t (when (and t.IsPublic (>= t.FullName.Length 69)) (prns t.FullName)))
System.Security.Cryptography.CryptographicUnexpectedOperationException
System.ComponentModel.Design.Serialization.DesignerSerializerAttribute
System.ComponentModel.Design.Serialization.IDesignerSerializationManager
System.ComponentModel.Design.Serialization.IDesignerSerializationProvider
System.ComponentModel.Design.Serialization.IDesignerSerializationService
System.ComponentModel.Design.Serialization.RootDesignerSerializerAttribute
System.Security.Cryptography.X509Certificates.X509CertificateCollection
System.Windows.Forms.ComponentModel.Com2Interop.ICom2PropertyPageDisplayService
reifnir said
If we're counting enums, MessageSecurityVersion has this one coming in at 103 characters long: WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10 Property