Show / Hide Table of Contents

    IDataPacker.Count Property

    .NET Standard 2.x

    Gets the number of elements that have been added into the IDataPacker object.

    Namespace: SnapObjects.Data

    Assembly: SnapObjects.Data.dll

    Syntax

    int Count { get; }
    

    Property Value

    System.Int32

    Returns the number of elements in the IDataPacker object.

    Examples

    The following code example gets the number of elements in the DataPacker object.

    using SnapObjects.Data;
    using System;
    
    namespace Appeon.ApiDoc.IDataPackerExamples
    {
        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");
    
                // Gets and shows the number of elements
                Console.WriteLine("The element count: {0}", packer.Count);
    
                /* This code example produces the following output:
                
                The element count: 2
                */
            }
        }
    }
    

    Applies to

    .NET Standard

    2.x

    Back to top Generated by Appeon