I am sure a very basic question. The ultimate aim is to take a range in Excel which will generally contain text and doubles and dump the contents into an SQL database.
I want to take the range (this is entered into the c# code as an object[,]
) dump it into an XML string and save this directly into the database.
I have written a number of my own classes which I serialize easily using the DataContractSerializer
. However when it comes to serializing the object[,]
I am running into a brickwall and a lot of searching the net just tells me how I can serialize more complex user defined classes which I already know.
Is it possible to serialize this primitive type ? And if so how ?
You can't serialize multidimensional arrays using DataContractSerializer
.
From msdn :
Combining collection types (having collections of collections) is allowed. Jagged arrays are treated as collections of collections. Multidimensional arrays are not supported.
Switch from object[,]
to object[][]
which means from multidimensional array to jagged array.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.