VB.NET转C# [英] VB.NET to C#

查看:70
本文介绍了VB.NET转C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



伙计们;


有人可以告诉我相应的

静态关键字在C#


公共函数testFunc()as Integer


''--------------------- -------------------

''是否可以从内部执行此操作

''函数in C#


静态暗淡计数为整数= 0

count + = 1


返回计数


结束函数

我们可以在C#中的方法中使用静态字段吗?或者我们是否需要在b / b外面声明它? br />

谢谢


Fred


Guys;

could someone please tell me the equivalent for the
Static keyword in C#

public function testFunc() as Integer

''----------------------------------------
'' Is it possible to do this from inside
'' the function in C#

Static Dim count as Integer = 0

count += 1

return count

end function
Can we have a static field in the method in C# or do we
need to declare it outside

Thanks

Fred

推荐答案

freddie< an ******* @ discussion.microsoft.com>写道:
freddie <an*******@discussions.microsoft.com> wrote:
有人可以告诉我等效的C /

公共函数testFunc()为整数

''----------------------------------------
''是吗?可以从内部做到这一点
''中的函数C#

静态暗淡计数为整数= 0

数+ = 1
返回计数

结束函数

我们可以在C#中的方法中有一个静态字段,还是我们需要在外面声明它
could someone please tell me the equivalent for the
Static keyword in C#

public function testFunc() as Integer

''----------------------------------------
'' Is it possible to do this from inside
'' the function in C#

Static Dim count as Integer = 0

count += 1

return count

end function
Can we have a static field in the method in C# or do we
need to declare it outside




您需要将其声明为该类型的成员。如果你考虑一下,

这个值是对象状态的一部分,所以

声明它是有意义的。

-

Jon Skeet - < sk *** @ pobox.com>
http://www.pobox.com/~skeet

如果回复该群组,请不要给我发邮件。 />



You need to declare it as a member of the type. If you think about it,
the value is part of the state of the object, so it makes sense to
declare it as such.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too


freddie< an ******* @ discussion.microsoft.com>写道:
freddie <an*******@discussions.microsoft.com> wrote:
有人可以告诉我等效的C /

公共函数testFunc()为整数

''----------------------------------------
''是吗?可以从内部做到这一点
''中的函数C#

静态暗淡计数为整数= 0

数+ = 1
返回计数

结束函数

我们可以在C#中的方法中有一个静态字段,还是我们需要在外面声明它
could someone please tell me the equivalent for the
Static keyword in C#

public function testFunc() as Integer

''----------------------------------------
'' Is it possible to do this from inside
'' the function in C#

Static Dim count as Integer = 0

count += 1

return count

end function
Can we have a static field in the method in C# or do we
need to declare it outside




您需要将其声明为该类型的成员。如果你考虑一下,

这个值是对象状态的一部分,所以

声明它是有意义的。

-

Jon Skeet - < sk *** @ pobox.com>
http://www.pobox.com/~skeet

如果回复该群组,请不要给我发邮件。 />



You need to declare it as a member of the type. If you think about it,
the value is part of the state of the object, so it makes sense to
declare it as such.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too


静态 VB.Net中的等价物是共享。
The "static" equivalent in VB.Net is "Shared".
我们可以在C#中的方法中使用静态字段吗?
我们是否需要在外部声明它。
你需要在外面宣布它。
http://www.google。 ca / groups?hl = en& lr ... TNGP09.phx.gbl


-

Tim Wilson

..Net Compact Framework MVP

" freddie" <一个******* @ discussions.microsoft.com>在留言中写道

news:00 **************************** @ phx.gbl ... <伙计们;

有人可以请告诉我相应的C /

公共函数testFunc()作为整数

''----------------------------------------
' '是否有可能从内部做到这一点
''中的函数C#

静态暗淡计数为整数= 0

数+ = 1

返回计数

结束函数

我们可以在C#中的方法中有一个静态字段,还是我们需要在外面声明它

谢谢

Fred
Can we have a static field in the method in C# or
do we need to declare it outside. You need to declare it outside.
http://www.google.ca/groups?hl=en&lr...TNGP09.phx.gbl

--
Tim Wilson
..Net Compact Framework MVP

"freddie" <an*******@discussions.microsoft.com> wrote in message
news:00****************************@phx.gbl...
Guys;

could someone please tell me the equivalent for the
Static keyword in C#

public function testFunc() as Integer

''----------------------------------------
'' Is it possible to do this from inside
'' the function in C#

Static Dim count as Integer = 0

count += 1

return count

end function
Can we have a static field in the method in C# or do we
need to declare it outside

Thanks

Fred



这篇关于VB.NET转C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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