console application - How to convert an input string to uppercase in c# -
string choice = string.toupper(console.readline()); i want input string , convert upper case. however, there's error states :
cannot convert 'string' system.globalization.cultureinfo'
that appears when hover on console.readline(). why doesn't work , , fixes there? , there way ?
string.toupper instance method, means have use "on" string:
string input = console.readline(); string choice = input.toupper(); otherwise using the overload takes cultureinfo object. since string not convertible system.globalization.cultureinfo compiler error. it's misleading anyway, can't use instance method without instance, yields error:
string.toupper(cultureinfo.currentculture); // string want upper-case??! an object reference required non-static field, method, or property 'string.toupper(cultureinfo)
a method can used without instance of type if static.
Comments
Post a Comment