S
Sin Jeong-hun
if( (myList!=null) && (myList.Count>10) )
{
Do something....
}
The code above throws an exception if "myList" is null. Even though
the left condition is false so that the whole condition must be false,
it looks like C# also tries to evaluate the right condition. To avoid
the exception I have to code as
if( myList!=null )
{
if( myList.Count>10 )
{
Do something....
}
}
This can be trivial but,it requires a little more typing and rows in
the source code. I think C# doesn't need to check the right condition
in this situation, What do you think?
{
Do something....
}
The code above throws an exception if "myList" is null. Even though
the left condition is false so that the whole condition must be false,
it looks like C# also tries to evaluate the right condition. To avoid
the exception I have to code as
if( myList!=null )
{
if( myList.Count>10 )
{
Do something....
}
}
This can be trivial but,it requires a little more typing and rows in
the source code. I think C# doesn't need to check the right condition
in this situation, What do you think?