I have different List of Custom class. and need to check for the properties of String type and validate the value of the property. if has some thing wrong value then change the value with some predefined value. For this I thought to create a Generic method of public IEnumerable validate (this IEnumerable ListofData)
but now I am unable to traverse on the properties and check the value and return the same after manipulating. Please find the sample code.
Thanks.
public static class ValidateExt
{
public static IEnumerable<T> ValidateStringData<T>(this IEnumerable<T> DataList)
{
PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(typeof(T));
foreach(T Item in DataList)
{
// here want to manipulate the date of those properties which is of string type and assign it back.
}
}
}