IDataUnpacker.Count Property
.NET Standard 2.x
Gets the number of elements added in the IDataUnpacker
object.
Namespace: SnapObjects.Data
Assembly: SnapObjects.Data.dll
Syntax
int Count { get; }
Property Value
System.Int32
The number of elements added in the IDataUnpacker
object.
Examples
The following code example calculates the number of elements of DataUnPacker
object.
using SnapObjects.Data;
using System;
namespace Appeon.ApiDoc.IDataUnpackerExamples
{
public class CountExample
{
private readonly SchoolContext _context;
public CountExample(SchoolContext dataContext)
{
// Sets the data context.
_context = dataContext;
}
public void Example()
{
var packer = new DataPacker();
packer.AddValue("Name", "Name1");
packer.AddValue("Age", 30);
var json = packer.GetTextString(DataFormat.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);
/* This code example produces the following output:
The element count: 2
*/
}
}
}
Applies to
.NET Standard
2.x