C# aufrufen interface-Methoden innerhalb der Klasse

interface ILol
{
   void LOL();
}

class Rofl : ILol
{
   void ILol.LOL()
   {
      GlobalLOLHandler.RaiseROFLCOPTER(this);
   }
   public Rofl()
   {
      //Is there shorter way of writing this or i is there "other" problem with implementation??
      (this as ILol).LOL();
   }
}
Versuchen Sie zu vermeiden zu nennen, "virtual" - Funktionen von einem Konstruktor! Sie können am Ende ruft eine Implementierung, die auf eine nicht vollständig konstruierten Objekt.

InformationsquelleAutor 0xDEAD BEEF | 2010-05-10

Schreibe einen Kommentar