ary[0, 0] = ""
ary[0, 1] = "Jan 2010"
ary[0, 2] = "Feb 2010"
...
ary[0, 13] = "- Year 2010"
ary[1, 0] = 89544.994
ary[1, 1] = 93202.257
...
ary[1, 13] = 492331.908
ary[2, 0] = "Report A"
...
ary[16, 13] = ...
The number of rows and columns for this two dimensional array are passed in an outer (Message) context.
What is the technique for dealing with the NSData and extracting & parsing back into an objective-c (or Swift) arrays?
Are there helper classes I should be aware of to help in these scenarios?
Thanks
public static RangeData ToRangeData(this object[] source)
{
var result = new RangeData();
result.Rows = (int)source[0];
result.Columns = (int)source[1];
var formatted = ObjectToByteArray(source[2]);
result.Data = ByteString.CopyFrom(formatted);
return result;
} var ba = rangeData.Data.ToByteArray();
var array = (Array)ba.FromByteArrayToObject();
ViewData = new ViewData((object[,])array);Call ObjectToByteArray extension method, which uses the .Net BinaryFormatter class (and MemoryStream) to convert the object to a byte array (byte[] in .Net)
I can't say I know C# to comment much on that side of things. It does sorta look like you are using something more native to those objects for serializing into a blob, and simply using a proto to try and package the row & col counts along with the blob. It probably would make more sense to do something like Jorge suggests and use protos for the full packaging rather than just the outer packaging.TVL