I was under the impression that if I pass a class to a function as a reference, that reference can be nullable.
Example: I have a code-first entity class / database table:
public class Table1
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public int FillID { get; set; }
public int OrderID { get; set; }
public int FillQuantity { get; set; }
public DateTime TransactionDateTime { get; set; }
public virtual tblInstruments tblInstruments { get; set; }
}
I'd like to create a function which has the following signature:
public static void Function1 (int? i, Table1? t)
The Table1? t
gives the a error:
only non-nullable value type could be underlying of System.Nullable
So I'm not sure what I'm doing wrong. I tried
public static void Function1 (int? i, ref Table1? t)
But that did not resolve the issue.
Any pointers would be greatly appreciated.