How to handle null values when reading array
-
I have an array that I am converting values from. It is a comma delimited file, and has some null values in it. While I am reading the file to convert, how can I handle the null values?
with code ? I don't see what the question is. If you are writing code to convert values, can't you check for null first ? It's up to you if you skip a null, or insert a default value in it's place.
Christian Graus Driven to the arms of OSX by Vista. "I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
-
with code ? I don't see what the question is. If you are writing code to convert values, can't you check for null first ? It's up to you if you skip a null, or insert a default value in it's place.
Christian Graus Driven to the arms of OSX by Vista. "I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
-
I have an array that I am converting values from. It is a comma delimited file, and has some null values in it. While I am reading the file to convert, how can I handle the null values?
impossible to answer: you hardly described the input and didn't say a thing about the output. explain more, AND give some examples. :)
Luc Pattyn [Forum Guidelines] [My Articles]
Avoiding unwanted divs (as in "articles needing approval") with the help of this FireFox add-in
-
I apologize if my question seemed stupid. I am looking for assistance with the code, which is why I am in the C# message board. :((
If you posted some code, then perhaps we could assist you with your code. As it stands, we're struggling to understand what the hell you're talking about. If you have null values coming in ( we don't even know where from ), then you can check for them, surely ? Perhaps not, in your situation, but you've not come close to making that clear.
Christian Graus Driven to the arms of OSX by Vista. "I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
-
I have an array that I am converting values from. It is a comma delimited file, and has some null values in it. While I am reading the file to convert, how can I handle the null values?
Please Don't Worry You can Solve NullException problem Using one of the two methods :) . 1) If you create Your own Array Please Initalize it.
List<String> strArray= new List<String>();
strArray.Add("Code Project");Here new List<String>(); is important
- If you get the list from any where else You can check for null as follows
if(strArray != null)
if(strArray.Count >0)
MessageBox.Show(strArray[0]);SibGeth
Something Differentâ„¢