Search code examples
c#.netconstructorbll

BLL returning the right Type of an instance


I have a class "Artikel" and there i write some Business Logic. I also have a class "tArtikel" which is a type. In my class "Artikel" I work with "tArtikel" and returns are of that type. Now when i instantiate an "Artikel" i want it to be of type "tArtikel", so what i tried in my code is:

      public tArtikel Artikel()
      {
        tArtikel artikel = new tArtikel();
      }

Which results in: "'Artikel' member names cannot be the same as their enclosing type".

How would i set this up correctly?


Solution

  • Since the class name is Artikel the only functions that can be named Artikel are constructors which in turn don't have a return type.

    public Artikel()
    {
    }