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

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -