当我们在c#.net中使用static关键字时? [英] When we use static keyword in c#.net?

查看:83
本文介绍了当我们在c#.net中使用static关键字时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我们在c#.net中使用static关键字时?

为什么我们在c#.net中使用静态关键字?



在c#.net中使用vb.net中的静态关键字是什么?



vb.net和c#.net中是否有任何静态功能?

When we use static keyword in c#.net?
Why we use static keyword in c#.net?

what is the keyword used in vb.net for static in c#.net ?

Is any feature not available for static among vb.net and c#.net ?

推荐答案

参见在这里: C#中的静态是什么? [< a href =http://www.codeproject.com/Answers/66956/What-is-static-in-Csharp.aspx#answer1target =_ blanktitle =New Window> ^ ] 。



请参阅此处的 VB中的静态模拟 [ ^ ]。



最好的问候,



-MRB
See here: What is "static" in C#?[^].

See here for the Static analogon in VB[^].

Best Regards,

-MRB


你好,



static关键字定义,即class / p您声明为静态的roperty /方法不需要先前的对象实例。另一方面,静态方法例如不能使用自己对象的任何实例方法/实例属性。



静态定义的东西也将由编译器优化,例如,静态对象只在内存中写入一次,并且所有内容都访问同一个对象。



在这里,您可以获得有关static关键字的更详细信息:

http://msdn.microsoft.com/en-us/library/98f28cdx .aspx [ ^ ]



谷歌搜索也有帮助:

http://www.google.com/ [ ^ ]



我很抱歉没有回答VB问题,但我不是VB专家,也不知道如何在VB.NET中解决这个问题。也许谷歌有更多的答案。



希望这会有所帮助。



祝你好运,周末愉快,

停止
Hello,

The static keyword defines, that the class / property / method you declare as static does not require an previous instance of a object. In the other hand, a static method for example cannot use any instance method / instance property of the own object.

Also static defined things will be optimized by the compiler, for example that a static object is only written once in the memory and everything accesses to the same object.

Here you get perhaps more detailed informations about the static keyword:
http://msdn.microsoft.com/en-us/library/98f28cdx.aspx[^]

Also a google search would help:
http://www.google.com/[^]

I'm sorry about not answering the VB Questions, but I'm not a VB specialist and do not know how this is solved in VB.NET. Perhaps google have some more answers.

Hope this helps.

Best regards and have a nice weekend,
Stops


静态关键字C# [ ^ ]



静态vb.net [ ^ ]



不那么简单。在你提出要求之前进行搜索。



PS - 答案会将你的问题移出未答复的清单。
Static keyword C#[^]

static vb.net[^]

Wasn't that simple. Do search before you ask.

PS - the answer will move your question out of the unanswered list.


这篇关于当我们在c#.net中使用static关键字时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆