When trying to create a generic class in C# I am doubtful about how to proceed.
Say I want to create a generic class with certain values on Blazor. (most of the time I've seen TItem used in Blazor projects, be as part of a component or in pure C# classes)
public class Disc<TItem> where TItem : class
{
public IEnumerable<IValues<TItem>> Dataset { get; set; }
[JsonIgnore]
public string Title{ get; set; }
}
public interface IValues<TItem>
{
IEnumerable<TItem> Items { get; set; }
object Song { get; set; }
string Lyrics { get; set; }
}
Isn't that the same as this? Just curious....
public class Disc<T> where T : class
{
public IEnumerable<IData<T>> Dataset { get; set; }
[JsonIgnore]
public string Title { get; set; }
}
public interface IValues<T>
{
IEnumerable<T> Items { get; set; }
object Song { get; set; }
string Lyrics { get; set; }
}