Yesterday someone asked whether there is difference between String.Empty and "". I answered promptly "there is no difference".
What I thought at the time is that we can write a test:
Assert.AreEqual(String.Empty, "");
this will pass the test.
But today, when I think about this question more carefully. I will say there is difference between them.
String.Empty is intialed at run time.
so we can say:
const strA="";
static readonly strB=String.Empty;
but we cannot write const strA=String.Empty;Just take a quick notes.
No comments:
Post a Comment