Show / Hide Table of Contents

    DynamicModel.PropertyCount Property

    .NET Standard 2.x

    Gets the number of the properties used in the current DynamicModel object.

    Namespace: SnapObjects.Data

    Assembly: SnapObjects.Data.dll

    Syntax

    public int PropertyCount { get; }
    

    Returns

    System.Int32

    The number of the properties used in the current DynamicModel object.

    Examples

    The following code example gets the total number of properties of the DynamicModel object.

    using SnapObjects.Data;
    using System;
    
    namespace Appeon.ApiDoc.DynamicModelExamples
    {
        public class PropertyCountExample
        {
            private readonly SchoolContext _context;
    
            public PropertyCountExample(SchoolContext dataContext)
            {
                // Sets the data context.
                _context = dataContext;
            }
    
            public void Example()
            {
                string sql;
    
                sql = "select CourseID, Title from Course";
                DynamicModel dynamicModel =
                    _context.SqlExecutor.SelectOne<DynamicModel>(sql);
    
                // Gets the total number of properties in DynamicModel
                var count = dynamicModel.PropertyCount;
                Console.WriteLine("Property Count = {0}", count);
    
                /*This code produces the following output:
                
                Property Count = 2
                */
            }
        }
    }
    

    Applies to

    .NET Standard

    2.x

    Back to top Generated by Appeon