If two names match in one locale, they are guaranteed to match in all locales. Names and LocalesĬomparison of names is independent of locale. Therefore, when you release an updated version of an assembly, you should not change the alphabetic case of any public elements. If you subsequently recompile your class and change the element's name to abc, the other assemblies using your class could no longer access that element. To try to upgrade an element, given as input an element element, run the following steps: Let definition be the result of looking up a custom element definition given element's node document, element's namespace, element's local name, and element's is value. For example, if you define a class with an element called ABC, and other assemblies make use of your class through the common language runtime, they must refer to the element as ABC. Set element's custom element state to 'custom'. Therefore, when you produce an assembly or a DLL and make it available to other assemblies, your names are no longer case-insensitive. However, the common language runtime (CLR) uses case-sensitive binding. For example, it considers ABC and abc to refer to the same declared element. This means that when the compiler compares two names that differ in alphabetic case only, it interprets them as the same name. Case Sensitivity in NamesĮlement names in Visual Basic are case-insensitive. The integrated development environment (IDE) provides an easy way to do this. Otherwise, you should consider renaming the element if its name conflicts with a keyword. You are working with code written in another language in which the given keyword is not reserved. Your code has migrated from a previous version of Visual Basic that did not reserve the keyword being used as a name or In general, you should use escaped names only when: You also use the brackets when you refer to the name later in your code. An escaped name can match any Visual Basic keyword, since the brackets remove any ambiguity. However, you can define an escaped name, which is enclosed by brackets ( ). It must contain at least one alphabetic character or decimal digit if it begins with an underscore. It must only contain alphabetic characters, decimal digits, and underscores. ![]() ![]() Generally, an element name must not match any of the keywords reserved by Visual Basic, such as Case or Friend. An element name in Visual Basic must observe the following rules: It must begin with an alphabetic character or an underscore ( ). If somebody else is trying to understand it, or if you yourself are looking at it a long time after you wrote it, suitable element names can save a considerable amount of time. This is important for the readability of your code. On the other hand, your name should not be so short that it does not adequately describe what the element represents and how your code uses it. This improves the readability of your code and reduces line length and source-file size. Name Length GuidelinesĪs a practical matter, your name should be as short as possible while still clearly identifying the nature of the element. However, an underscore in any other position in an element name is CLS-compliant. Consider the following JUnit test snippet which exercises serializing an object that contains multiple lists to XML.Element names starting with an underscore ( _) are not part of the Language Independence and Language-Independent Components (CLS), so CLS-compliant code cannot use a component that defines such names.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |