public class DoctorsData
{
string _doctorName;
public string DoctorName { get { return _doctorName; } }
string _doctorAge;
public string DoctorAge { get { return _doctorAge; } }
string _doctorCity;
public string DoctorCity
{
get { return _doctorCity; }
set { _doctorCity = value; }
}
string _doctorDesc;
public string desc
{
get
{
return _doctorDesc;
}
set
{
_doctorDesc = value;
}
}
public DoctorsData(string doctorname, string doctorage, string doctorcity, string doctordesc)
{
_doctorName = doctorname;
_doctorAge = doctorage;
_doctorCity = doctorcity;
_doctorDesc = doctordesc;
}
}
그리고 코드 아래사용 LINQ 문
목록에 데이터를 추가하는 것입니다 일반적인 목록을 정의 데를 사용하여 콜렉션에서 삭제하는 방법 : -
List<DoctorsData> doctorlist = new List<DoctorsData>();
doctorlist.Add(new DoctorsData("mukesh", "32","sirsa","aclass"));
doctorlist.Add(new DoctorsData("rajesh", "29","hisar","bclass"));
doctorlist.Add(new DoctorsData("suresh", "25","bangalore","cclass"));
doctorlist.Add(new DoctorsData("vijay", "24","bangalore","cclass"));
doctorlist.Add(new DoctorsData("kumar anna", "40","trichi","aclass"));
내 요구 사항은 난입니다 30 세 미만의 모든 의사 항목을 삭제하고 싶습니다. 어떻게 LINQ를 사용하여이 작업을 수행 할 수 있습니까?
감사합니다.이 코드가 작동합니다. –