I don't have much experience with using the yield keyword. I have these IEnumerable<T> extensions for Type Conversion.
My question is does the first overloaded method have the same yield return effect that I'm getting from the second method?
public static IEnumerable<TTo> ConvertFrom<TTo, TFrom>(this IEnumerable<TFrom> toList)
{
return ConvertFrom<TTo, TFrom>(toList, TypeDescriptor.GetConverter(typeof(TTo)));
}
public static IEnumerable<TTo> ConvertFrom<TTo, TFrom>(this IEnumerable<TFrom> toList, TypeConverter converter)
{
foreach (var t in toList)
yield return (TTo)converter.ConvertFrom(t);
}