等价的C#关键字 [英] Equivalent C# keyword
本文介绍了等价的C#关键字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
只是想知道是否有一个等同于Myclass的关键字。在VB.Net
in C#
TIA
Krishnan
Hi,
Just curious to know if there''s a keyword equivalent to "Myclass" in VB.Net
in C#
TIA
Krishnan
推荐答案
我认为它''基础''
我==这个
MyClass == base
Krishnan写道:
I think its ''base''
Me == this
MyClass == base
Krishnan wrote:
只是想知道是否有一个等同于Myclass的关键字。在VB.Net
在C#
TIA
Krishnan
Hi,
Just curious to know if there''s a keyword equivalent to "Myclass" in VB.Net
in C#
TIA
Krishnan
嗨哈维,
感谢您的回复。对不起,但是,我不相信是这样的。我用b $ b试图用一个例子来解释这个:
[VB.Net代码]
模块模块1
Sub Main()
Dim b As Base
b = New Derived1
>
b.Test()
End Sub
结束模块
班级基础
公共子测试()
Me.Foo()
MyClass。 Foo()
End Sub
Public Overridable Sub Foo()
Console.WriteLine (Base - Foo)
End Sub
结束班级
Class Derived1
继承基础
公开覆盖子Foo()
Console.WriteLine(" Derived1 - Foo)
End Sub
结束班级
输出:
=====
Derived1 - Foo
Base - Foo
换句话说,MyClass拨打电话给功能总是在t上他是同一个
等级的继承链,与继承中的规则有关
是称为最的。方法的派生形式(由行完成
Me.Foo()。如果你认为这个场景可以是用C#模拟的
,请告诉我,如果是这样的话。如果你能发布你的代码,我将不胜感激。
片段。
TIA
Krishnan
" Harvey Green" no **** @ somewhere.com>写在留言中
news:Op ******* ******* @ TK2MSFTNGP09.phx.gbl ...
Hi Harvey,
Thanks for your reply. Am sorry, but, I don''t believe that to be the case. I
have tried to explain this with an example:
[VB.Net code]
Module Module1
Sub Main()
Dim b As Base
b = New Derived1
b.Test()
End Sub
End Module
Class Base
Public Sub Test()
Me.Foo()
MyClass.Foo()
End Sub
Public Overridable Sub Foo()
Console.WriteLine("Base - Foo")
End Sub
End Class
Class Derived1
Inherits Base
Public Overrides Sub Foo()
Console.WriteLine("Derived1 - Foo")
End Sub
End Class
Output:
=====
Derived1 - Foo
Base - Foo
In other words, MyClass makes the call to the function always on the "same"
class ireespective of the inheritance chain, wihle the rule in inheritance
is to call the "most" derived form of the method(as is done by the line
Me.Foo(). Please let me know if you think that this scenario can be
simulated in C#, and if so how. I''d be grateful if you can post your code
snippet here.
TIA
Krishnan
"Harvey Green" <no****@somewhere.com> wrote in message
news:Op**************@TK2MSFTNGP09.phx.gbl...
我认为它的''基础''
我==这个
MyClass = = base
Krishnan写道:
I think its ''base''
Me == this
MyClass == base
Krishnan wrote:
只是想知道在
VB中是否有一个等同于Myclass的关键字。网络C#
TIA
Krishnan
Hi,
Just curious to know if there''s a keyword equivalent to "Myclass" in VB.Net in C#
TIA
Krishnan
Hi Krishnan,>
呵呵,我不认为C#有同等价值。
-
Miha Markic - RightHand。 NET咨询和软件开发
miha at rthand com
" Krishnan" < KR ********************* @ myrealbox.com>在留言中写道
新闻:%2 **************** @ TK2MSFTNGP10.phx.gbl ...
Hi Krishnan,
huh, I don''t think that C# has an equivalent.
--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com
"Krishnan" <kr*********************@myrealbox.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
只是想知道是否有一个等同于Myclass的关键字。 in
VB.Net in C#
TIA
Krishnan
Hi,
Just curious to know if there''s a keyword equivalent to "Myclass" in VB.Net in C#
TIA
Krishnan
这篇关于等价的C#关键字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文