Show / Hide Table of Contents

    DynamicModel.GetValue(int index) Method

    .NET Standard 2.x

    Gets the value of the specified property (by index) in the DynamicModel object.

    Namespace: SnapObjects.Data

    Assembly: SnapObjects.Data.dll

    Syntax

    public object GetValue(int index)
    

    Parameters

    index System.Int32

    The zero-based index of the property to get value.

    Returns

    System.Object

    Returns the value of the specified property.

    Examples

    The following code example gets the property value at the specified index in the DynamicModel object.

    using SnapObjects.Data;
    using System;
    
    namespace Appeon.ApiDoc.DynamicModelExamples
    {
        public class GetValueExample
        {
            private readonly SchoolContext _context;
    
            public GetValueExample(SchoolContext dataContext)
            {
                // Sets the data context
                _context = dataContext;
            }
    
            public void Example1()
            {
                string sql;
    
                sql = "select * from Course";
                DynamicModel dynamicModel =
                    _context.SqlExecutor.SelectOne<DynamicModel>(sql);
    
                // Gets the property value whose index=0
                var value = dynamicModel.GetValue(0);
                Console.WriteLine("Value = {0}", value.ToString());
    
                /* The code example produces the following output:
                
                Value = 1045
                */
            }
        }
    }
    

    Applies to

    .NET Standard

    2.x

    Back to top Generated by Appeon