Maximum Method Name Length

前端 未结 9 1667
忘了有多久
忘了有多久 2020-11-30 05:19

Does anyone happen to know what the maximum length of a method name is in your programming language of choice? I was going to make this a C# specific question, but I think i

9条回答
  •  再見小時候
    2020-11-30 06:05

    I just did a test in C# Visual Studio 2010 (x64): made an identifier:

    int a123456789a123...;
    

    And repeated. At 512 characters, VS gives me the error "Identifier too long." 511 is fine though. (Checked character count in Word.)

    Another example:

    int whyintheworldwouldyoueverhaveanidenfifierthislongitsreallyjustquiteridiculousimeancmonyoucouldatleasthavethecommoncourtesyofmakingitcamelcasesoitsnotsohardtoreadcmonjuststopnowyourereallyreachingtomakethisaslongaspossiblearentyou123412341234alrightwellthatsenoughnowisntitwelliguessnotbecauseimstillgoingthisisofficallytheworstidentifiereverಠ_ಠokaynowthatithasunicodeitsofficialbutseriouslythisthingissolongthatihadtogetupinthemiddleofittotakeabreakbeforesittingdowntofinishtoppingitofftothemaxcharlimitof___511;
    

提交回复
热议问题