您的位置:首页 > 其它

丶将字母全部转换为大写或小写

2011-10-18 20:32 441 查看
using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

namespace Example35

{

public partial class Form1 : Form

{

public Form1()

{

InitializeComponent();

}

private void Form1_Shown(object sender, EventArgs e)

{

this.Text = "将字母全部转换为大写或小写";

}

private void button1_Click(object sender, EventArgs e)

{

if (radioButton1.Checked)

{

textBox2.Text = textBox1.Text.ToUpper(); //转换为 大写

}

if (radioButton2.Checked)

{

textBox2.Text = textBox1.Text.ToLower(); //转换为 小写

}

}

}

}

//字符串是 不可变 对象 每当对字符串进行操作时 都将产生一个新的字符串对象 尽量避免频繁操作字符串对象 因为频繁操作会在托管堆中产生大量的无用字符串 增加垃圾收集器的压力 从而造成系统资源的浪费!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐