Is thread-safe to use the 'yield' operator inside a static method'?

Posted by SDReyes on Stack Overflow See other posts from Stack Overflow or by SDReyes
Published on 2010-04-23T23:25:07Z Indexed on 2010/04/23 23:33 UTC
Read the original article Hit count: 284

Filed under:
|
|
|
|

Is a static method using yield thread-safe?

For example:

public static T Select<T>( this IDataReader reader, Func<IDataReader, T> convertString )
{
        {
            while( reader.Read( ) )
                yield return convertString( reader );
        }
}

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET