多行字符串变量
多行字符串变量
在.Net(C#和VB.NET)中,如果我有一个多行文本如下:
__ __ _ \ \ / / | | \ V /___ _ _ _ __ | | ___ __ _ ___ \ // _ \| | | | '__| | | / _ \ / _` |/ _ \ | | (_) | |_| | | | |___| (_) | (_| | (_) | \_/\___/ \__,_|_| \_____/\___/ \__, |\___/ __/ | |___/
我可以这样设置变量吗?
Dim Logo As String = (" __ __ _ \ \ / / | | \ V /___ _ _ _ __ | | ___ __ _ ___ \ // _ \| | | | '__| | | / _ \ / _` |/ _ \ | | (_) | |_| | | | |___| (_) | (_| | (_) | \_/\___/ \__,_|_| \_____/\___/ \__, |\___/ __/ | |___/ ") Console.WriteLine(Logo)
...而不是这样:
Console.WriteLine("__ __ ") Console.WriteLine("\ \ / / | | ") Console.WriteLine(" \ V /___ _ _ _ __ | | ___ __ _ ___ ") Console.WriteLine(" \ // _ \| | | | '__| | | / _ \ / _` |/ _ \ ") Console.WriteLine(" | | (_) | |_| | | | |___| (_) | (_| | (_) |") Console.WriteLine(" \_/\___/ \__,_|_| \_____/\___/ \__, |\___/ ") Console.WriteLine(" __/ | ") Console.WriteLine(" |___/ ")
...或者这样:
Dim Logo As String = ( _
"__ __ _ " & vbNewLine & _
"\ \ / / | | " & vbNewLine & _
" \ V /___ _ _ _ __ | | ___ __ _ ___ " & vbNewLine & _
" \ // _ \| | | | '__| | | / _ \ / _` |/ _ \ " & vbNewLine & _
" | | (_) | |_| | | | |___| (_) | (_| | (_) |" & vbNewLine & _
" \_/\___/ \__,_|_| \_____/\___/ \__, |\___/ " & vbNewLine & _
" __/ | " & vbNewLine & _
" |___/ ")