Feed
Google+
Contact
XING
LinkedIn
Twitter
ICQ
meebo.com

I hate such questions 70-536-

by Roland Schumacher alias GENiALi 21. April 2008 -- 166 words  -- 1 mal gelesen

This was the question.

Which of the following code samples is the most efficient and compiles correctly?

The following answers were available.

1.

string s = null;
StringBuilder sb = null; SB.Append("Hello"); SB.Append(",_"); SB.Append("World"); SB.Append("!"); s = sb.ToString();

2.

string s = null;
StringBuilder sb = null; SB = "Hello"; sb += ", "; SB += "World"; sb += "!"; s = sb.ToString();

3.

string s = null;
s = "Hello";
s += ", ";
s += "World"; s += "!";

4.

string s = null;
s = "Hello";
s += ", ";
s += "World"; s += "!";

For me it was clear, it must be 3 or 4. But I find there
no difference.1 can not be. StringBuilder is null
and there you can do not append. 2 The StringBuilder is
incorrectly applied.

1 Was right. How so? It is efficient and can compile.
But do not. This was also the question.

I hate such questions.

Tags: ,
It works: Madonna - Madonna - ray of light - frozen

Tags:

Kommentare sind geschlossen

Statistik

Gesamte Posts: 1025
Dieses Jahr: 7
Diesen Monat: 1
Diese Woche: 0
Kommentare: 929
Total Bewertungen: 91
Ø Bewertung: 4,42
Meisten Kommentare
Google+ ... (28)
Beste Ø Bewertung
Tastaturlayout von Visual Stud ... (5)
Meiste Bewertungen
Windows 7 und die ersten Erfah ... (5)

Buttons

Stop Spam Harvesters, Join Project Honey Pot Benutzerprofil von GENiALi connection speed test network connection Bloggeramt.de Slug.ch Blog Verzeichnis und Blog Webkatalog Schumacher Roland Seitwert Valid XHTML 1.0 Transitional

writing