P
Peter Morris
In Delphi I used to use Assert as a development aid. During debug it would
ensure that certain conditions were met but in the Release build the Asserts
were not compiled into the application. I am assuming this is the same with
..NET too? Debug.Assert isn't compiled into a Release build?
The other thing I am curious about is this
public void DoSomething(Person p)
{
if (p == null)
throw new ArgumentNullException("P");
....
}
Why do people tend to use exceptions such as ArgumentNullException instead
of something like this which I presume gets skipped in Release build and is
also quicker to type?
public void DoSomething(Person p)
{
Debug.Assert(p != null, "P is null");
....
}
Pete
ensure that certain conditions were met but in the Release build the Asserts
were not compiled into the application. I am assuming this is the same with
..NET too? Debug.Assert isn't compiled into a Release build?
The other thing I am curious about is this
public void DoSomething(Person p)
{
if (p == null)
throw new ArgumentNullException("P");
....
}
Why do people tend to use exceptions such as ArgumentNullException instead
of something like this which I presume gets skipped in Release build and is
also quicker to type?
public void DoSomething(Person p)
{
Debug.Assert(p != null, "P is null");
....
}
Pete