The problem:
Given I have the following:
using System;
public class BaseClass{
public static Type TypeOfThis => //Somehow get the type of the inheriting class?
public static void HelloWorld() => Console.WriteLine($"Hello world, I am {TypeOfThis.Name}");
}
public class InheritingClass:BaseClass{}
How can I reference the type of the inheriting class?
GetType
requires a reference, which we do not have, as we are working statically.
Aucun commentaire:
Enregistrer un commentaire