IDataUnpacker.DataFormat Property
.NET Standard 2.x
Gets the format of the text specified when creating the IDataUnpacker
object.
Namespace: SnapObjects.Data
Assembly: SnapObjects.Data.dll
Syntax
DataFormat DataFormat { get; }
Property Value
The format of the text specified when creating the IDataUnpacker
object.
It only supports the DataFormat.Json
format so far.
Examples
The following code example gets the data format of the IDataUnPacker
object.
using SnapObjects.Data;
using System;
namespace Appeon.ApiDoc.IDataUnpackerExamples
{
public class DataFormatExample
{
private readonly SchoolContext _context;
public DataFormatExample(SchoolContext dataContext)
{
// Sets the data context.
_context = dataContext;
}
public void Example()
{
var packer = new DataPacker();
packer.AddValue("name", "Name1");
packer.AddValue("address", "Address1");
var json = packer.GetTextString(DataFormat.Json);
// Specifies the data format to Json
var dataUnPacker = new DataUnpacker(json, DataFormat.Json);
// Gets and shows the number of elements in dataUnPacker
Console.WriteLine("The element count: {0}", dataUnPacker.Count.ToString());
// Gets the data format of dataUnPacker
Console.WriteLine("DataFormat: {0}", dataUnPacker.DataFormat.ToString());
/* This code example produces the following output:
The element count: 2
DataFormat: Json
*/
}
}
}
Applies to
.NET Standard
2.x