有关base..ctor的解释() [英] An explanation about base..ctor()
问题描述
我碰到我的朋友们的应用程序开发。然后在代码中,我得到了混乱这样的代码:
I'm getting an application from my friends to develop. Then in the code I got confusing code like this:
public someNameHere()
{
base..ctor();
}
嗯,我从来没有过这样的应用程序。我需要为这个
Well I've never had an application like this. I need an explanation for this
base..ctor()的说明;
base..ctor();
我google搜索,并不能找到答案满足我。我很感谢你给我任何帮助。
I've googling and can't find answer that satisfy me. I appreciate for any help you give me.
推荐答案
.ctor()
是构造使用的内部名称。它不使用在C#的方式,并不能编译。
.ctor()
is the internal name used by constructors. It is not used that way in C#, and does not compile. More typically, base..ctor()
is only used by the compiler when doing things like:
public class Foo : Bar {
public Foo(string s) : base(s) {...}
public Foo() {...} // has an implicit :base()
}
我见过的做不同的唯一时间是当反编译(通过反射镜等)的一些非C#IL,做建筑的代码以不同的顺序,以C#编译器是怎么做的,这因而没有在纯C#可表达。在原始的IL(和C ++等),你可以在构造函数中的任何一点的调用基构造函数的 - 不只是在启动
The only times I've seen that done differently is when decompiling (via reflector etc) some non-C# IL that does the construction code in a different sequence to how the C# compiler does it, which is therefore not expressable in "pure" C#. In raw IL (and from C++ etc) you can call the base-constructor at any point in the constructor - not just at the start.
这篇关于有关base..ctor的解释()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!