Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialaj luther
3,888 PointsAre single quotes a valid for of signifying text in C#?
The quiz doesn't accept the single quotes which I placed the first time and I wondered if single quotes were valid in their place.
1 Answer
Steven Parker
231,275 PointsThere are some languages (like JavaScript and Python) which use more than one token to indicate strings, but in C# only the normal quote character (") is used to indicate a string.
The apostrophe (a.k.a "single quote") is used in C# to indicate single characters:
string s = "This is a string";
char c = 'x'; // this is a single character