Interviews3 answers
3 Answers
string is keyword(blue color)
string s = "C-SharpCorner.com";
Console.WriteLine(s);
output:
C-SharpCorner.com
String is Class(Green color)
String s = new String('A',5);
Console.WriteLine(s);
output:
AAAAA
prints the character 5 times
Pavan RamamurthyPosted Aug 29, 2013, 2:19 AM EDT
Both are premitive data type but 'string' is for
C# and 'String' for .net framework
Gohil JayendrasinhPosted Mar 16, 2009, 9:18 AM EDT
There's no difference.
The C# type 'string' is just an alias for the .NET type 'System.String'.
So, as long as you include the following using directive in your program:
using System;
then 'string' and 'String' can be used interchangeably.
AlanPosted Nov 4, 2008, 12:22 PM EST

