>Hopefully somebody can provide a better way of doing this. The UserId field in my datareader is uniqueidentifier type in SQL Server.
>
>
>Guid UserId = new Guid(Convert.ToString(reader["UserId"]));
>
>
>Would this be better (more efficent):
>
>Guid UserId = (Guid) reader["UserId"];
>
>
>Overall, is it better to use the System.Convert method or do a cast like the second example?
It is already a Guid. Just cast it, no need to convert it to a string and then back to a Guid.
PS: Using Linq you don't even need the reader and do casting. Just work like as if you were working with a VFP table:)
Cetin