I have a byte[] array
from a bitmap.
I could save it to a file via:
File.WriteAllBytes("path&fileName", byte[]arrayName);
There are other variables that reference this byte[] array
, such as its name, its original location, etc.
In short, how do I collectively save data or group a few variables into a set for the sake of saving bitmap reference values?
(data = byte[], name=string, loctionX = int, locationY = int, Width=int ....etc)
Does this task belong to the database field only or is there another way? For example, can I use XML or linq? (I am trying to guess) (: I'm trying to avoid involving databases (SqlDatasource connection ...etc) in my project.
You should declare a POCO for the values you want to store and serialize it. For example:
Now pick any serializer; XmlSerializer, DataContractSerializer, protobuf-net, BinaryFormatter, JSON.NET - any would do; and use that to read/write the instance from/to disk. For example: