我看MSDN上面写的
一个是:Treats 'text' as a string.
另一个是:Treats "text" as a string.都一样啊。但是我在编译
using System;
class CharPractice
{
public static void Main()
{
Console.WriteLine(Char.IsPunctuation('A'));
}
}
这样一段程序的时候,使用单引号将字母A括起来就能正确编译并执行显示出“false”;但如果使用双引号把字母A括起来的话,编译时就会出现如下报错:
CharPractice.cs(6,21): error CS1502: The best overloaded method match for
'char.IsPunctuation(char)' has some invalid arguments
CharPractice.cs(6,40): error CS1503: Argument '1': cannot convert from 'string' to 'char'
一个是:Treats 'text' as a string.
另一个是:Treats "text" as a string.都一样啊。但是我在编译
using System;
class CharPractice
{
public static void Main()
{
Console.WriteLine(Char.IsPunctuation('A'));
}
}
这样一段程序的时候,使用单引号将字母A括起来就能正确编译并执行显示出“false”;但如果使用双引号把字母A括起来的话,编译时就会出现如下报错:
CharPractice.cs(6,21): error CS1502: The best overloaded method match for
'char.IsPunctuation(char)' has some invalid arguments
CharPractice.cs(6,40): error CS1503: Argument '1': cannot convert from 'string' to 'char'
解决方案 »
- 讨论贴:业务逻辑层\事务\存储过程,分层开发的选择!?
- 无法将类型 System.Windows.Forms.HtmlElement 转换为 mshtml.HTMLBody
- 如何截取QQ信息,并转发
- 一个编译错误----关于Activator.CreateInstance的
- c#的处理问题
- 请问,怎样通过程序来判断一个C#程序是release版还是debug版?
- 使用vs2005将一个dataview绊定数据源,删除出错,提示必须声明变量,何故?
- 要四了!救命呀!高手,大侠快来!
- VBNET转C#的问题
- 300分寻找《ASP.NET技术内幕》电子书
- 从C++来的,C#中如何定义类型的别名?
- gridview 取选定行的列值问题!
用""扩起来表示string类型在Char.IsPunctuation()这个方法中的参数只能是char类型,所以你放入string类型就出错了