In IEnumerable and LINQ,
How Convert to Double from string ??
I want to return the values of the SCROE column as a list of double types.
How Convert to Double from string ??
I want to return the values of the SCROE column as a list of double types.
C#:
using System;
using Sylvan.Data;
using Sylvan.Data.Csv;
using System.Collections.Generic;
using System.Linq;
using var csvReader = CsvDataReader.Create("data.csv");
IEnumerable<Pepole> Pepoles = csvReader.GetRecords<Pepole>();
IEnumerable<Pepole> GroupbyedPepoles = Pepoles.GroupBy(r => r.subject); //<=Is the Groupby syntax correct?
List<Pepole> DoubleTyped = GroupbyedPepoles.??????(n=>n.scroe).ToList(); //<=I want to import Scroe Column as double type.
class Pepole
{
public string ID {get; set;}
public string NAME {get; set;}
public string SCHOOL {get; set;}
public string SUBJECT {get; set;}
public string SCROE {get; set;}
}
Last edited: