create a generic modal logic class with list of items in csharp

Here is an example implementation of a generic ModalLogic class that can hold a list of items:

main.cs
public class ModalLogic<T>
{
    private List<T> items;

    public ModalLogic()
    {
        items = new List<T>();
    }

    public void Add(T item)
    {
        items.Add(item);
    }

    public void Remove(T item)
    {
        items.Remove(item);
    }

    public bool Contains(T item)
    {
        return items.Contains(item);
    }

    public List<T> GetItems()
    {
        return items;
    }
}
412 chars
30 lines

This class uses generics to allow any type of item to be stored in the list. The constructor initializes the list, and the Add, Remove, and Contains methods provide basic list manipulation functionality. Finally, the GetItems method returns the full list of items.

gistlibby LogSnag