Is VB really case insensitive?

后端 未结 14 2065
名媛妹妹
名媛妹妹 2020-11-30 05:28

I\'m not trying to start an argument here, but for whatever reason, it\'s typically stated that Visual Basic is case insensitive and C languages aren\'t (and somehow that is

14条回答
  •  迷失自我
    2020-11-30 05:53

    Yes, the VB.NET compiler treats identifiers in a case insensitive way. And yes, that can cause problems when it consumes assemblies that were written in another language or uses COM components. The former case is covered by the Common Language Specification. The relevant rule is:

    For two identifiers to be considered distinct, they must differ by more than just their case.

    The COM case is rather crudely taken care of by the type library builder, it forces the casing of identifiers with the same name to be identical. Even when those identifiers have different roles. In other words, a method parameter with the name "index" will force a method name "Index" to be recased to "index". That has produced rather a lot of head scratching, as you might imagine :)

提交回复
热议问题