public abstract class MyBase
{
public abstract bool TryGetValue<TResult>(out TResult result);
}
public class MyGeneric<T> : MyBase
{
private T _value;
public override bool TryGetValue<TResult>(out TResult result) where TValue : default
{
if(typeof(TResult) != typeof(T))
{
result = default;
return false;
}
return (TResult)Value;
}
}
public abstract class MyBase
{
public abstract bool TryGetValue<TResult>(out TResult result);
}
public class MyGeneric<T> : MyBase
{
private T _value;
public override bool TryGetValue<TResult>(out TResult result) where TValue : default
{
if(typeof(TResult) != typeof(T))
{
result = default;
return false;
}
return (TResult)Value;
}
}