In reference to using .Equals() or == on strings, here is a question in regards to checking for string.Empty and null objects.
In comparing string.Empty and null objects, should I use == or should I use .Equals()?
// Add vars to instance variables
for (int i = 0; i < paramFirstList.Count; i++)
{
// if the key is null, replace it
// with a "null" string
if (paramFirstList[i] == null)
{
_firstList.Add("null");
}
else if (paramFirstList[i] == string.Empty)
{
_firstList.Add("empty");
}
else
{
// Do something
}
}
P.S. I understand it's better to store null and string.Empty as their object types, but for this particular purpose, it is in my requirements to store them as a string representation :).
P.P.S. Added hungarian notation for the sake of question clarity