Multiple parameters in a List. How to create without a class?

后端 未结 10 1998
不知归路
不知归路 2020-12-12 23:25

This is probably a pretty obvious question, but how would I go about creating a List that has multiple parameters without creating a class.

Example:

10条回答
  •  执念已碎
    2020-12-13 00:29

    Get Schema Name and Table Name from a database.

            public IList> ListTables()
            {
    
                DataTable dt = con.GetSchema("Tables");
    
                var tables = new List>();
    
                foreach (DataRow row in dt.Rows)
                {
                string schemaName = (string)row[1];
                string tableName = (string)row[2];
                //AddToList();
                tables.Add(Tuple.Create(schemaName, tableName));
                Console.WriteLine(schemaName +" " + tableName) ;
                }
                return tables;
            }
    

提交回复
热议问题