if null set zero C# code example Example: int if null put zero c# var number = null; int result = number.GetValueOrDefault();