Regarding use .Equals()or ==in strings, the question arises here about checking objects string.Emptyand null.
When comparing objects string.Emptyand nullshould use ==or use .Equals()?
for (int i = 0; i < paramFirstList.Count; i++)
{
if (paramFirstList[i] == null)
{
_firstList.Add("null");
}
else if (paramFirstList[i] == string.Empty)
{
_firstList.Add("empty");
}
else
{
}
}
PS I understand that it is better to store nulland string.Emptyhow to object types, but for this specific purpose in my requirements to keep them as the string representation :).
PPS Added Hungarian notation for the sake of clarity.
source
share