因为我的家庭作业中的以下代码显示了一个错误,类型或命名空间名称'boolean‘找不到
class LinkedList
{
private Node first;
public LinkedList()
{
first = null;
}
public boolean isEmpty()
{
return (first == null);
}
public void insert(int val)//inserts at beginning of list
{
Node newNode = new Node(val);
newNode.next = first;
first = newNode;
}
public Node delete()//deletes at beginning of list
{
Node temp = first;
first = first.next;
return temp;
}我在网上到处都发现了类似的问题,但都不完全是布尔式的,谁来帮帮我。顺便说一句,我正在学习3-4年的c#。
发布于 2012-07-16 04:30:33
在C#中是bool (小写b)或Boolean。考虑使用bool,因为它要短得多,并且与其他语言(除了Java...)更一致。
bool关键字是System.Boolean的别名。
来源:http://msdn.microsoft.com/en-us/library/c8f5xwh7%28VS.71%29.aspx
发布于 2012-07-16 04:31:17
在C#中,我们没有关键字boolean,我们将其作为System.Boolean
另外,bool关键字是System.Boolean的别名。它用于声明变量以存储布尔值,true和false。
https://stackoverflow.com/questions/11495361
复制相似问题