C
C#12mo ago
SWEETPONY

✅ why ArgumentException.ThrowIfNullOrEmpty(); is only for string?

I have following:
public class A
{
A(AnotherClass AC)
{
// how to check AC for null?
var vc = new Test(AC);
}
}
public class A
{
A(AnotherClass AC)
{
// how to check AC for null?
var vc = new Test(AC);
}
}
7 Replies
SWEETPONY
SWEETPONYOP12mo ago
I don't want to use if(AC==null)
Pobiega
Pobiega12mo ago
No description
Angius
Angius12mo ago
Because only a string can be "empty"
Pobiega
Pobiega12mo ago
NullOrEmpty is only really a thing for strings
SWEETPONY
SWEETPONYOP12mo ago
ArgumentNullException.ThrowIfNull?
Pobiega
Pobiega12mo ago
ye
SWEETPONY
SWEETPONYOP12mo ago
ah okey thanks

Did you find this page helpful?