Anwind
Well-known member
- Joined
- Nov 6, 2021
- Messages
- 48
- Programming Experience
- 1-3
Hello
Convert to Idatareader from List ??
Is it possible??
The source below is a static type. (using system.collections.generic)
Is the grammar correct???
Convert to Idatareader from List ??
Is it possible??
Main CS:
using System.Data.Linq
.
.
public class Main
{
Reader csvdata = new Reader(new StreamReader(D:\\CSVFILE.CSV), true);
IDataReader iDataReader = csvdata;
IEnumerable<IDataReader> ret = IDataReaderEx.AsEnumerable(); // I need to return an IDataReader in the end.
}
The source below is a static type. (using system.collections.generic)
Is the grammar correct???
IDataEx:
using System.Data.Linq
using System.Collections.generic
public static class IDataReaderEx
{ // The source below is a static type. (using system.collections.generic)
public static class CsvList
{
public static string Name;
public static string Id;
}
public static IEnumerable<IDataReader> AsEnumerable(this System.Data.IDataReader source)
{
List<CsvList> list = new List<CsvList>();
CsvList clsList = new CsvList();
while (source.Read())
{
clsList.Name = source["Name"].ToString();
clsList.Id = source["Id"].ToString();
list.Add(clsList);
}
var retList = list.where(n=>n.Name == "ABC");
yield return ???? ;
}
}
Last edited: