Questions tagged [null-string]
11 questions
11
votes
3 answers
JsonConvert.SerializeObject: Unexpected result when Serializing null value
In the line of code below, my string x ends up being an actual string "null" when clInitializer.AVOptions = null value:
string x = JsonConvert.SerializeObject(clInitializer.AVOptions, new JsonSerializerSettings { NullValueHandling =…

concentriq
- 359
- 2
- 6
- 16
8
votes
2 answers
C# 7 switch case with null checks
C#7 introduces a new feature called patterns, which you can use with Is-Expression or Switch cases like this:
string str = null;
switch(str){
case string x:
Console.WriteLine("string " + x);
break;
default:
…

MAbdulHalim
- 389
- 4
- 14
8
votes
7 answers
String.IsNullOrEmpty(myString) Vs myString != null
Which one is better among these three?
string myString = "";
String.IsNullOrEmpty(myString);
vs
string myString = "";
if(myString.Length > 0 || myString != null)
vs
string myString = "";
if (m.Length > 0 | m != null)
Former is clearer but is…

Asad
- 21,468
- 17
- 69
- 94
6
votes
2 answers
Why does [NullString]::Value evaluate differently with a breakpoint?
I've tried this code in PowerShell ISE and VS Code with the same strange result. Without a breakpoint, the output is EMPTY, but with a breakpoint in the line with "NULL", the output is NULL (as expected). Why?
function demo {
param(
…

andiDo
- 309
- 4
- 11
2
votes
1 answer
Passing null string value via environment variable to TSQL script
I have a DOS batch file I want to use to invoke a TSQL program.
I want to pass the names of the databases to use. This seems to work.
I want to pass the PREFIXES for the names of the tables I want to work with.
So for test tables I want to pass the…

elbillaf
- 1,952
- 10
- 37
- 73
1
vote
2 answers
jQuery serialize method returns null
I am trying to submit the form using jQuery but the serialize method returns null. What's going wrong? Help is very much appreciated.
Here is my code.
HTML / PHP code