c# - Problems with an overloaded function inside a Generic Function -
i writing function serialize data pass through socket. wanted write small function serialize 1 item.
private byte[] serializeone<t>(t data) { byte[] oneitem = new byte[constants.one_item_buffer]; oneitem = bitconverter.getbytes(data); if (bitconverter.islittleendian) oneitem.reverse(); return oneitem; }
the problem bitconverter alwaysassumes data type bool , throws error: argument 1 cannot convert t bool. missing syntax force bitconverter use t type or not possible in c#?
Comments
Post a Comment