Set nullable types in Dynamics 365 & C#
Post by: syed hussain in C# Development Dynamics 365
Summary
A little code snippet demonstrating how to set nullable types in Microsoft Dynamics 365 CE.
The code
// Set a Two Options to null
bool? nullOption = null;
entity["myoption"] = nullOption;
// Set int to null
int? nullNumber = null;
entity["mynumber"] = nullNumber;
// Set OptionSetValue to Null
OptionSetValue myNullOption = new OptionSetValue();
myNullOption = null;
entity["new_optionset"] = myNullOption;
Tags: c# nullable OptionsetValue