What does adding a “c” do in a VB.NET character array?

后端 未结 1 503
广开言路
广开言路 2021-01-12 12:15

I would like to use the String method IndexOfAny to check if a character exists in a specified string.

Examples I\'ve found online, of using the IndexOfAny method in

相关标签:
1条回答
  • 2021-01-12 12:44

    That is a suffix for a literal of type System.Char. So

    Dim foo As Char = "x"c
    

    Will compile (when Option Strict is set to either On or Off). Without the c, it would be interpreted as a string. For more information about literal suffixes in VB.NET, take a look at the MSDN page, "Constant and Literal Data Types".

    0 讨论(0)
提交回复
热议问题