I have a method that I want to override:
public override bool CanConvert(Type objectType)
(Note: I cannot modify the superclass.) Anyway, in this overridden method I want to do:
return typeof(MyClass<T, I>).IsAssignableFrom(objectType);
MyClass is abstract. I wrote it myself.
Intellisense underlines the generic part. So I have to make the method generic. But then the method signature is not compatible with the override.
What should I do?
EDIT:
MyClass:
MyClass<T,I> where T : MyClass<T,I>
EDIT 2:
The class that contains method:
public class ReferencesJsonConverter : JsonConverter
Do I need to add
<T,I>
to ReferencesJsonConverter? That is unfortunate, since the class is used like this:
[JsonConverter(typeof(ReferencesJsonConverter))]
public virtual WhateverClass whateverclass {get;set;}
T is WhateverClass...
I also have this method I need to override
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
I want to do:
var e = value as MyClass<T, I>;
in there. So I guess I really NEED to add
<T,I>
to the class itsself?