Click here to Skip to main content
15,909,205 members
Everything / Nullable

Nullable

Nullable

Great Reads

by D Sarthi Maheshwari
Extension method on String class to convert string to IConvertible structs and nullable types
by raddevus
Function to help convert null to DBNull.Value for inserting in database
by Oktay Ekincioglu
Exception handling practices like avoiding null values, writing predictable function signatures, avoiding null reference exceptions, etc.

Latest Articles

by raddevus
Function to help convert null to DBNull.Value for inserting in database
by Oktay Ekincioglu
Exception handling practices like avoiding null values, writing predictable function signatures, avoiding null reference exceptions, etc.
by D Sarthi Maheshwari
Extension method on String class to convert string to IConvertible structs and nullable types

All Articles

Sort by Score

Nullable 

17 Mar 2016 by Matt T Heffron
You've declared the method to return a double but are trying to return double?[].Edit [MTH]://a command in a windows form to plot a chartprivate void cmdCHART_Click(object sender, EventArgs e){ // Does this really need to be created new each time it is used? // If nmCHART...
13 Mar 2015 by Sergey Alexandrovich Kryukov
Let's see.In base.CaseData.ID, base cannot be null, but base.CaseData can. The fact that ID can also be null (as nullable) does not matter, because you did not reach this point. The exception is thrown when you dereference base.CaseData trying to access the ID property. If you try to...
29 Nov 2021 by OriginalGriff
The null checks are there for a reason - to make sure that there is a User, that the user has an Address, and the address includes a State - without these, there is no information to process - and the null return is the way the method tells you...
18 Apr 2013 by Sergey Alexandrovich Kryukov
In brief: this is a matter of internal implementation of CLR. There is no a contradiction. Why cannot it contain null. If you define some structure, and add '?' after the type name, it creates new type, not the same as your structure. The idea is well explained...
17 Jun 2013 by Sergey Alexandrovich Kryukov
You might also mean nullable object, like int?. The answer will be the same: assign the object to some value. How could it possibly be not obvious?—SA
18 Jun 2014 by Vedat Ozan Oner
There must be a bug in linq-to-entities for version 5.0. I have tested it with version 6.1 and I didn't observe such thing.here is the code:class Program { static void Main(string[] args) { int? i1 = null; using (TESTEntities ctx = new...
18 Jun 2014 by ubudak
as mention the article below, setting "ObjectContextOptions.UseCSharpNullComparisonBehavior Property" to true is enough for solutionhttp://www.seventy-3.com/entity-framework-and-null-variables/
6 Jan 2015 by Coding123456
I have written the following code to do this but is there a more elegant way?I have 2 nullable Enum's. I want to compare them to each other, where none, one or both can be null. I have to test separately for equality and test for the null condition. Is there a better way? Private...
7 May 2015 by Brady Kelly
I realize this question sounds stupid, but please bear with me. I have a class like this:public class DropDownListViewModel{ private bool _valueIsSet; private TScalar _value; //private Nullable _nullableValue; private SelectList _selectList; ...
7 May 2015 by Dave Kreskowiak
I don't know what you're doing but it looks like you need to determine if TScalar is nullable?Perhaps you're looking for this: Type valueType = _value.GetType(); if (valueType.IsGenericType && valueType.GetGenericTypeDefinition() == typeof(Nullable)) { // Handle...
31 May 2015 by pyler
I'm trying to add signin/signup functionality in my NavigationDrawer app but I'm running into this problem when I compile the project. "FATAL EXCEPTION Caused by: java.lang.NullPointerException at MainActivity.onCreate(MainActivity.java:111)"Here's that line...
17 Mar 2016 by Trader999
I have a query on a table where nulls are allowed in the columns. The method then returns the query results as an array to plot a chart. The chart command is in a windows form and the database query is in a class. I thought the query line where P!=null excluded nulls, but I still get an error...
18 Mar 2016 by Trader999
here is another solution with the help of othersdouble[] Y = new double[21]; Y = oCHART.GET_Y_SERIES("CONDOR").Where(d => d.HasValue).Cast().ToArray();
15 Apr 2016 by Trader999
I have added a dgvcomboboxcol to an existing dgv. The dgvcomboboxcol will replace an existing column and allow for user selection. The code adds a list of items a user can select from, but I'd like to set the dgvcomboboxcol with a default the same as the column it replaced. The code below is...
29 Nov 2021 by Member 15435322
This is my method, which I am using Optional to avoid NullPointerException, but I want to do that using without if else statement to avoid nullpointer exception. is it possible or is there any way, that I say using without if else statement...
14 Jun 2022 by Will Sewell
I am a novice programmer. I have a few single value return "gets" that return ID's that looks like this: Controller.GetCustomerIDByCustomerName(item.Customer.ToLower().Trim(), out int CustomerID); ...
14 Jun 2022 by RickZeeland
See: ?? and ??= operators - C# reference | Microsoft Docs[^]
16 Nov 2014 by D Sarthi Maheshwari
Extension method on String class to convert string to IConvertible structs and nullable types
16 Mar 2023 by raddevus
Function to help convert null to DBNull.Value for inserting in database
23 Nov 2017 by Oktay Ekincioglu
Exception handling practices like avoiding null values, writing predictable function signatures, avoiding null reference exceptions, etc.
17 Jun 2014 by ubudak
Hi,Let me explain my question in a simple example.I have a table named "Person" in mssql.I am using entity framework 5.0PersonId Name Number1 Tom 52 Mary NULL3 Henry 8"Number" field is a nullable field.When I run the code below, it finds the...
18 Apr 2013 by Mayank_Gupta_
Nullables are itself a structure and structure cannot contain "Null". So how are we able to assign "Null" values to "Nullable"Types
16 Mar 2016 by Sascha Lefèvre
You select P.DATASo you should check P.DATA for not being null, not P:var qryY = (from P in Globals.DATA.PAYOFF_EAVs where P.GREEK == GREEK && P.DATA != null orderby P.DP_NO select P.DATA ).ToArray();
17 Jun 2013 by Ron Beyer
object a = null; //a is now nulla = new Widget(); //a is now an instance of WidgetThat's the only way to "un-null" a value. You have to assign something to it.
13 Mar 2015 by Sam 9100
In my UI layer, I have a Form with a tabControl, where a user control (with child controls) is placed. Upon loading user control, I get object reference not set to an instance of an object in if statement. My ID can be null, but how do I initialize it first? Or do the if statement differently?...
31 Mar 2015 by Sam 9100
All related issues revolved around not correctly creating the class instance in my form and in my user control. Once I set new instance and used that for all my child controls, it worked. This has been resolved.