我有一个 IEnumerable 变量,我想从中提取一个不同的值。我知道列表行中的所有条目都具有相同的值,我只需要获取该值。
该方法返回一个 IEnumerable。
IEnumerable 中的行定义为: QuoteCovId AdditionalInterestId AdditionalInterestsAffiliateId AdditionalInterestsLastName AdditionalInterestsBusinessAddrLine1 AdditionalInterestsBusinessCity AdditionalInterestsBusinessState AdditionalInterestsBusinessZip
代码示例:
IadditionalInterestData = AdditionalInterestData.GetAdditionalInterests(MasterPkgID, Requestor);
// Using linq.
var quotes = from ai in IadditionalInterestData
select Distinct(ai.QuoteCovId);
// Iterate thru to get the 1 value.
foreach (int QuoteCovId in quotes)
{
quoteID = QuoteCovId;
}