Show / Hide Table of Contents

    DynamicModel.CopyFrom(DynamicModel dynamicModel, int propertyStart, int propertyEnd) Method

    .NET Standard 2.x

    Copies the values of the properties within the specified scope of another DynamicModel object to the property of the corresponding location of the current DynamicModel object.

    Namespace: SnapObjects.Data

    Assembly: SnapObjects.Data.dll

    Syntax

      public void CopyFrom(DynamicModel dynamicModel, int propertyStart, int propertyEnd)
    

    Parameters

    dynamicModel SnapObjects.Data.DynamicModel

    The DynamicModel object from which to copy data.

    propertyStart System.Int32

    The zero-based index of the property where the copy starts.

    propertyEnd System.Int32

    The zero-based index of the property where the copy ends.

    Examples

    The following code example copies data from the specified range in the specified DynamicModel object.

    using SnapObjects.Data;
    
    namespace Appeon.ApiDoc.DynamicModelExamples
    {
        public class CopyFromExample
        {
            private readonly SchoolContext _context;
    
            public CopyFromExample(SchoolContext dataContext)
            {
                // Sets the data context
                _context = dataContext;
            }
    
            public void Example2()
            {
                string sql;
    
                sql = "select courseid,title from Course";
                DynamicModel dModel = _context.SqlExecutor.SelectOne<DynamicModel>(sql);
    
                var fromModel = _context.SqlExecutor.Select<DynamicModel>(sql);
    
                fromModel[0].CopyFrom(fromModel[1],0,1);
            }
        }
    }
    

    Applies to

    .NET Standard

    2.x

    Back to top Generated by Appeon