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

Popular posts from this blog

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

html - Outlook 2010 Anchor (url/address/link) -

android - How to create dynamically Fragment pager adapter -