c# - How do I write a list using BinaryWriter? -
i want use generic writelist(list value) function write list using binarywriter. here code using:
public void writelist<t>(list<t> value) { (int = 0; < value.count; i++) { _writer.write(value[i]); } }
the error receiving is:
error 1 best overloaded method match 'system.io.binarywriter.write(bool)' has invalid arguments error 2 argument 1: cannot convert 't' 'bool'
the binaryformatter absolutely not option.
if check out docs binarywriter you'll see doesnt accept argument of object (writes primitive types), , compiler trying best @ overload, , failing, since can't cast t bool, or else binarwwriter like.
you're going have convert object binarywriter work with.
Comments
Post a Comment