Friday, April 20, 2012

Use of Select function in Dictionary

private String GetFileName(int iPageNumber)
{
try
{
var objEnm = m_objDict.Select((Pages, index) => new { index, str = Pages.Value.Contains("," + iPageNumber + ",") });

String sKey = null;
foreach (var obj in objEnm)
{

if (obj.str == true)
{
IEnumerator objKeyClc = m_objDict.Keys.GetEnumerator();
int iIndex = 0;
while (objKeyClc.MoveNext())
{
if (obj.index == iIndex++)
{
sKey = objKeyClc.Current;
break;
}
}
}

}
return sKey;
}
catch (Exception ex)
{
throw ex;
}
}

No comments:

Followers

Link