Show / Hide Table of Contents

    IMetaList<TDwo>.Find(string name) Method

    .NET Standard 2.x

    Searches for an element according to the specified name.

    Namespace: DWNet.Data

    Assembly: DWNet.Data.dll

    Syntax

    TDwo Find(string name);
    

    Parameters

    name System.String

    The name of the element to search for.

    Examples

    The following code example demonstrates how to use the Find Method.

    using DWNet.Data;
    using System;
    
    namespace Appeon.ApiDoc.IMetaListExamples
    {
        public class FindExample
        {
            private readonly SchoolContext _context;
    
            public FindExample(SchoolContext dataContext)
            {
                // Sets the data context
                _context = dataContext;
            }
    
            public void Example()
            {
                // Instantiates datastore with datawindow: d_department
                var datastore = new DataStore("d_department", _context);
    
                datastore.Retrieve();
    
                var columnMetas = datastore.DwMeta.Columns;
                Console.WriteLine("Columns Count: {0}", columnMetas.Count);
    
                // Searches for the column named Departmentid which exists
                var column = columnMetas.Find("Departmentid");
                Console.WriteLine("ID: {0}; Name: {1}", column.ID, column.Name);
    
                // Searches for the column named DepartmentName which does not exist
                column = columnMetas.Find("DepartmentName");
                Console.WriteLine("ID: {0}; Name: {1}", column?.ID, column?.Name);
    
                /*This code produces the following output:
                
                Columns Count: 5
                ID: 0; Name: Departmentid
                ID: null; Name: null
                */
            }
        }
    }
    

    Example Refer To

    Model Class: D_Department
    DataWindow File: d_department

    Applies to

    .NET Standard

    2.x

    Back to top Generated by Appeon