Struggling with generic class... design?

I have BaseClass that other classes will extend from:
c#
public class BaseClass {
  public BaseClass() { /* Constructor */ }
  public static T? JsonDeserialiseAs<T>(string json) where T : BaseClass { /* Do stuff */ }
}

public class MyClassA : BaseClass {
  public string? SomeProp { get; set; } // Some properties that BaseClass doesn't have
  public MyClassA() : base() { /* Constructor */ }
}
The extending classes will have properties that BaseClass doesn't have, do knowing the type is important for deserialization.
Instead of using MyClassA.JsonDeserialiseAs<MyClassA>(json) every time, I'd like to be able to use MyClassA.JsonDeserialize(json)

What's the best way I can achieve this?
Was this page helpful?