I'm wondering is there a way to send some kind of generics for example List <float> floatValues = new List<float>()
need to be sent to udp client. I don't know how to do that, any help will be appreciated!
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
What you want to do is known as serialization/deserialization
Instead of building your own serializer, I would recommend to use one of the existing libraries like XmlSerializer, SoapFormatter, BinaryFormatter, DataContractSerializer , DataContractJsonSerializer, JavaScriptSerializer, Json.Net, ServiceStack, Protobuf.Net ........
Here is an example using Json serialization
You can serialize
floatValues
using some serialization facility (like XmlSerializer, BinaryFormatter or DataContractSerializer) and than deserialize it back.Or you can create your own "application level protocol" and put to the stream type name and serializer type and use this information during deserialization process.