C# if statement if int is zero set the value to one code example Example: int if null put zero c# var number = null; int result = number.GetValueOrDefault();