nullable guid to guid c#
Use the ?? operator:
public static class Extension
{
public static Guid ToGuid(this Guid? source)
{
return source ?? Guid.Empty;
}
// more general implementation
public static T ValueOrDefault<T>(this Nullable<T> source) where T : struct
{
return source ?? default(T);
}
}