Search code examples
c#asp.netvisual-studiovisual-studio-2013objectdatasource

What's the difference between TypeName="API.MyClass+Clients" and TypeName="API.MyClass.Clients" in asp:ObjectDataSource?


I have the following asp:ObjectDataSource declaration :

<asp:ObjectDataSource runat="server" ID="ODS_Data"
     SelectMethod="GetData" TypeName="API.MyClass+Clients"/>

What's the difference between TypeName="API.MyClass+Clients" and TypeName="API.MyClass.Clients ?

The . vs the + .

Thanks


Solution

  • The . is for a class that belongs to a namespace directly. the + is for a nested class, eg:

    public namespace MyClass
    {
        public class Clients{}
    }
    

    Would lead to: Myclass.Clients

    While

    public class MyClass
    {
        public class Clients{}
    }
    

    Would lead to: MyClass+Clients