For partial classes, they must have the same fully qualified name.
myNameSpace.MyEnclosingClass.MyNestedClass
and myNameSpace.MyNestedClass
are two completely unrelated classes.
For the code example you provided, the first paragraph and the second paragraph are not allowed to exist at the same time. Even if allowed, their full names are still different.
If you need to use nested classes, you can add MyEnclosingClass in the third code and make it a partial class, and then put MyNestedClass in it.
namespace myNameSpace
{
internal partial class MyEnclosingClass
{
internal partial class MyNestedClass { }
}
}
namespace myNameSpace
{
internal partial class MyEnclosingClass
{
internal partial class MyNestedClass { }
}
}
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.