Thursday, May 9, 2013
Generate String From List
public static string GetSearchString<T>(this ObservableCollection<T> source, string valueField)
{
try
{
string returnString = String.Empty;
if (source.Count > 0)
{
foreach (var obj in source)
{
returnString = returnString + obj.GetType().GetProperty(valueField).GetValue(obj, null) + ",";
}
if (returnString == String.Empty)
{
returnString = returnString.Substring(0, returnString.Length - 1);
}
}
return returnString;
}
catch (Exception ex)
{
throw ex;
}
}
Labels:
Silverlight
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment