C
C#16mo 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
SWEETPONYOP16mo ago
I don't want to use if(AC==null)
Pobiega
Pobiega16mo ago
No description
Angius
Angius16mo ago
Because only a string can be "empty"
Pobiega
Pobiega16mo ago
NullOrEmpty is only really a thing for strings
SWEETPONY
SWEETPONYOP16mo ago
ArgumentNullException.ThrowIfNull?
Pobiega
Pobiega16mo ago
ye
SWEETPONY
SWEETPONYOP16mo ago
ah okey thanks

Did you find this page helpful?