I have a method like this:
public string StartCapture(string[] args)
{
if(args[0].Trim() == null || args[0].Trim() == string.Empty )
{
//do stuff
}
}
Why I get a note that args[0].Trim() == null will always be false?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Trim()is not going to return null. The issue you might have is ifargs[0]is null, orargsitself is null, but the result ofTrim()will never be null, and therefore the comparison to null will always be false.Trim Method
You may want to simply check