关于StreamReader SR = new StreamReader()的定义问题
发布网友
发布时间:2022-05-24 21:18
我来回答
共1个回答
热心网友
时间:2023-11-02 23:44
StreamReader SR=null;
switch (cmb_cPre.Text)
{
case "Default":
SR = new StreamReader(txt_fileName.Text, Encoding.Default);
break;
case "ASCII":
SR = new StreamReader(txt_fileName.Text, Encoding.ASCII);
break;
case "BigEndianUnicode":
SR = new StreamReader(txt_fileName.Text, Encoding.BigEndianUnicode);
break;
case "Unicode":
SR= new StreamReader(txt_fileName.Text, Encoding.Unicode);
break;
case "UTF32":
SR = new StreamReader(txt_fileName.Text, Encoding.UTF32);
break;
case "UTF7":
SR = new StreamReader(txt_fileName.Text, Encoding.UTF7);
break;
case "UTF8":
SR = new StreamReader(txt_fileName.Text, Encoding.UTF8);
break;
default:
MessageBox.Show("输入编码方式错误");
return;
break;
}