I want to use a generic WriteList(List value) function to write a List using the BinaryWriter. Here is the code I am using:
public void WriteList<T>(List<T> value)
{
for (int i = 0; i < value.Count; i++)
{
_writer.Write(value[i]);
}
}
The error I am receiving is:
Error 1 The best overloaded method match for 'System.IO.BinaryWriter.Write(bool)' has some invalid arguments
Error 2 Argument 1: cannot convert from 'T' to 'bool'
The BinaryFormatter is absolutely not an option.