나는 _clientList.Add(clientIDGuid, newsfeedClient);
Linq를 사용하여 일치하는 ID의 목록을 얻는 방법은 무엇입니까?
NewsfeedClient 클래스와 로그인 한 고객의 사전을 유지하고있다 :
는public class NewsfeedClient
{
/// <summary>
/// Represents Newsfeed's own clientID
/// </summary>
public string ClientIDGuid { get; set; } // also adding the dictionary's ID
/// <summary>
/// Represents the logged in client's session ID
/// </summary>
public string SessionID { get; set; }
public string Nickname { get; set; }
public int ProfileID { get; set; }
public GeoLocation Location { get; set; }
public List<MyDB.Models.Buddy> BuddyList { get; set; }
[ScriptIgnore]
public DateTime LastResponseTime { get; set; }
public class GeoLocation
{
public float Latitude { get; set; }
public float Longitude { get; set; }
}
}
Buddy
객체는 ProfileID
속성이 포함되어 있습니다.
일치하는 profileID가 새 클라이언트의 BuddyList에있는 모든 사전 clientID의 목록을 가져 오려고합니다.
here에서 볼 수 있듯이 Intersect 메서드가 작동 할 것으로 추측하고 있지만 적어도 하나의 루프를 만들지 않고 함께 넣는 방법을 잘 모르겠습니다.
- UPDATE -
클라이언트 ID가되지 않고 == profileID가 이들 값은 다르다.
, 명확하게 - 당신이 원하는 하나의 NewsFeedClient의 BuddyList에 포함 된 모든 ProfileId에 대한 모든 NewsFeedClient 객체를 찾으려면? – Tejs