Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In what .NET languages can a class derive from its own nested class?

In C#, trying to compile the following code yields an error, "Circular base class dependency involving 'A' and 'A.B'"

public class A : A.B
{
    public class B { }
}

However, I am looking at a 3rd party DLL via a decompiler, and seeing this structure. How is this possible? I can only assume the third party DLL was written in some other .Net language, but what language and what was the syntax?

like image 477
Omer Raviv Avatar asked Nov 30 '13 19:11

Omer Raviv


People also ask

What is nested class in C# net?

A nested class is a class declared in another enclosing class. It is a member of its enclosing class and the members of an enclosing class have no access to members of a nested class. Let us see an example code snippet of nested classes in C#.

Is nested class is a derived class?

If a class is nested in the public section of a class, it is visible outside the surrounding class. If it is nested in the protected section it is visible in derived classes, if it is nested in the private section, it is only visible for the members of the outer class.

What are nested classes in VB?

A nested class is quite simply a class defined within a class. Technically, wherever you can use a nested class you could use a non-nested class; thus the reason for employing the nested class idiom is a semantic reason.

Can we have public protected access modifiers in nested class C#?

A nested class can be declared with any access modifier, namely private, public, protected, internal, protected internal, or private protected.


1 Answers

It is because the dll you're trying to decompile is "obfuscated". the obfuscator change all the name of the classes so that decompilers cannot be decompiled.

like image 83
Pyisoe Avatar answered Oct 25 '22 07:10

Pyisoe