日期:2014-05-19  浏览次数:20513 次

出现“无法识别的转义序列”这哪的原因
public   string   ReadFile(string   FilePath)
{
System.IO.StreamReader   rd   =   System.IO.File.OpenText(FilePath);
string   StrRead   =   rd.ReadToEnd().ToString();
rd.Close();
return   StrRead;  
}
private   void   show()
{
this.Label1.Text=ReadFile( "D:\WMA格式.html ");
}

D:\WMA格式.html--出现“无法识别的转义序列”这哪的原因。
请各位帮忙。

------解决方案--------------------
在前面加个@

this.Label1.Text=ReadFile(@ "D:\WMA格式.html ");
------解决方案--------------------
或者加“\”进行转义

this.Label1.Text=ReadFile( "D:\\WMA格式.html ");