I'm trying To make the method to return a Tuple of: Tuple<DateTime?, DateTime?>.
In case the code is being able to generate two DateTime types, I'm uses the Tuple.Create to create a return statement with:
public Tuple<DateTime?, DateTime?> GeTuple()
{
if (something)
{
return Tuple.Create(startDate, endDate);
}
else
{
return Tuple.Create(null, null); //--> This line produce the error.
}
}
but I'm getting this error of:
The type arguments for method 'Tuple.Create(T1, T2)' cannot be inferred from the usage. Try specifying the type arguments explicitly.
Tuple.Create(null, null)and tell that you meant to create aTuple<DateTime?, DateTime?>. Usenew Tuple<DateTime?, DateTime?>(null, null)orTuple.Create((DateTime?)null, (DateTime?)null)- canton7