Sri
asked on
Checking for null while converting to Dictionary
Need help in C# 5 replacing value with empty collection for the null ones
Here result.Item1 is Tuple which i am converting in to dictionary
How can i check if the v.Value.Flow is null here if it is null i want to put an empty collection
//Structure of the class Info
public class Info
{
public IList<string> Type { get; set; }
public IList<string> Flow { get; set; }
}
//Trying to convert the returned result into dictionary
db.InsertMissingInfo(result.Item1.ToDictionary(k => k.Key, v => new Info { Type = v.Value.Type, Flow = v.Value.Flow }));
Here result.Item1 is Tuple which i am converting in to dictionary
How can i check if the v.Value.Flow is null here if it is null i want to put an empty collection
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER