我在看一个电子书,上面的有个关于方法的代码
using System;
class Test
{
public int max(int x,int y){
if(x>y)
return x;
else
return y; }
public void Main(){
Console.WriteLine("the max of 6 and 8 is:{0}",max(6,8));
}
}
我写出来用csc编译提示
C:\>csc max.cs
Microsoft (R) Visual C# .NET 编译器版本 7.10.3052.4
用于 Microsoft (R) .NET Framework 版本 1.1.4322
版权所有 (C) Microsoft Corporation 2001-2002。保留所有权利。error CS5001: 程序“c:\max.exe”未定义入口点
请问是什么原因
{0}表示什么意思,我在
string name=sunange;
Console.WriteLine("学习:{1}",name)
这样写为什么会出错,谢谢:)
using System;
class Test
{
public int max(int x,int y){
if(x>y)
return x;
else
return y; }
public void Main(){
Console.WriteLine("the max of 6 and 8 is:{0}",max(6,8));
}
}
我写出来用csc编译提示
C:\>csc max.cs
Microsoft (R) Visual C# .NET 编译器版本 7.10.3052.4
用于 Microsoft (R) .NET Framework 版本 1.1.4322
版权所有 (C) Microsoft Corporation 2001-2002。保留所有权利。error CS5001: 程序“c:\max.exe”未定义入口点
请问是什么原因
{0}表示什么意思,我在
string name=sunange;
Console.WriteLine("学习:{1}",name)
这样写为什么会出错,谢谢:)
解决方案 »
- 如何将端口内的视频流数据直接转发?
- Winform如何获取IE证书私钥的内容?
- 求助?datagridview问题
- 【【【【帮忙看句代码】】】】
- 模拟类似AltTab显示列表
- c#模拟鼠标点击,在线快结
- 关于OleDbCommand不能更新到数据库(access)的问题
- 新手入门.net,请高手指点一下好的书籍和学习方法!谢了!
- SqlDataAdapter 可以用来执行存储过程吗?
- 在dreamwearemx中设置好了数据库应用,但在IE中取不出数据,数据总数为0,没有其它错误,这是为何
- 一个用RASAPI进行拨号的疑问??????????????????????
- winform下datagrid的问题!
Microsoft (R) Visual C# .NET 编译器版本 7.10.3052.4
用于 Microsoft (R) .NET Framework 版本 1.1.4322
版权所有 (C) Microsoft Corporation 2001-2002。保留所有权利。max.cs(14,47): error CS0120: 非静态的字段、方法或属性“Test.max(int,
int)”要求对象引用
{
if(x>y)
return x;
else
return y;}
{
}{0}表示第一个参数string name=sunange;
Console.WriteLine("学习:{1}",name)你这样写都没有第二个参数,当然会报错拉
class Test
{
public static int max(int x,int y){
if(x>y)
return x;
else
return y; }
public static void Main(){
Console.WriteLine("the max of 6 and 8 is:{0}",max(6,8));
}
}
class Test
{
public int max(int x,int y){
if(x>y)
return x;
else
return y; }
public static void Main(){class1 c1 = new Class1();
Console.WriteLine("the max of 6 and 8 is:{0}",c1.max(6,8));
}
}