标题:请问:static在C#中是什么意思??
取消只看楼主
sjbird331
Rank: 1
等 级:新手上路
帖 子:76
专家分:0
注 册:2005-8-5
 问题点数:0 回复次数:0 
请问:static在C#中是什么意思??

在书上看了一程序,发现 pubilc void Method1() 和public static void Method1()竟然有质的不同,不加static程序运行不起来,请问static在C#z中是什么意思?
具体程序如下:
using System;
using System.Threading;

namespace 线程
{
/// <summary>
/// Class1 的摘要说明。
/// </summary>
class TestThread
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main(string[] args)
{
//
// TODO: 在此处添加代码以启动应用程序
//
Thread thread1=new Thread(new ThreadStart(Method1));
Thread thread2=new Thread(new ThreadStart(Method2));
thread1.Start();
thread2.Start();
}
public static void Method1()
{
for(int i=0;i<1000;i++)
Console.Write("a");
}
public static void Method2()
{
for(int i=0;i<1000;i++)
Console.Write("b");
}
}
}

搜索更多相关主题的帖子: static summary 意思 void using 
2007-03-20 14:16



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-125347-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.548636 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved