Every now and then, I bump into syntax that I've seen before, but never used. This is one of those times.
Can someone explain the purpose of ":this" or ":base" following a C# constructor method?
For example:
public MyClass(SomeArg arg) : this(new SomethingElse(), arg)
{
}
My gut feeling is that it is used to map a default argument onto another constructor method.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…