Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的 C# 应用程序中有一个char变量c和一个TextBox textbox1。我想做这个:
char
TextBox
textbox1.Text = (c + 2).ToString(); //this doesn't work, sure
例如:
c = 'b'; textbox1.Text = "d";
我怎样才能做到这一点?
不知道为什么每个人都选择int ...
textbox1.Text = ((char)(c + 2)).ToString();
textbox1.Text = ((char)(((int)c) + 2)).ToString();
尝试这个 -
textbox1.Text = Convert.ToChar((int)c +2).ToString()