C
C#5mo ago
TOKYODRIFT!

✅ 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
TOKYODRIFT!
TOKYODRIFT!5mo ago
I don't want to use if(AC==null)
Pobiega
Pobiega5mo ago
No description
Angius
Angius5mo ago
Because only a string can be "empty"
Pobiega
Pobiega5mo ago
NullOrEmpty is only really a thing for strings
TOKYODRIFT!
TOKYODRIFT!5mo ago
ArgumentNullException.ThrowIfNull?
Pobiega
Pobiega5mo ago
ye
TOKYODRIFT!
TOKYODRIFT!5mo ago
ah okey thanks