string
is an alias in C# for System.String
.
So technically, there is no difference. It’s like int
vs. System.Int32
.
As far as guidelines, it’s generally recommended to use string
any time you’re referring to an object.
e.g.
string place = "world";
Likewise, I think it’s generally recommended to use String
if you need to refer specifically to the class.
e.g.
string greet = String.Format("Hello {0}!", place);
This is the style that Microsoft tends to use in their examples.
It appears that the guidance in this area may have changed, as StyleCop now enforces the use of the C# specific aliases.
Related Posts:
- What’s the @ in front of a string in C#?
- Best way to repeat a character in C#
- How can I convert String to Int?
- What is a singleton in C#?
- My C# application is returning 0xE0434352 to Windows Task Scheduler but it is not crashing
- C# Set collection?
- Why is Dictionary preferred over Hashtable in C#?
- Does anyone still use [goto] in C# and if so why?
- How does the “Using” statement translate from C# to VB?
- What is the best way to parse html in C#? [closed]
- Best C# API to create PDF
- C# cannot convert method to non delegate type
- What is the difference between const and readonly in C#?
- Pass Method as Parameter using C#
- ArrayList vs List<> in C#
- How to solve ‘…is a ‘type’, which is not valid in the given context’? (C#)
- Calling the base constructor in C#
- String was not recognized as a valid DateTime ” format dd/MM/yyyy”
- How to empty a list in C#?
- Substring index and length must refer to a location within the string
- How to open an Excel file in C#?
- What is a method group in C#?
- How to convert UTF-8 byte[] to string
- .NET String.Format() to add commas in thousands place for a number
- How do I save a stream to a file in C#?
- Print Pdf in C#
- Can a Byte[] Array be written to a file in C#?
- What is a quick way to force CRLF in C# / .NET?
- How to create a new object instance from a Type
- Creating a List of Lists in C#
- Unrecognized escape sequence for path string containing backslashes
- C# int to byte[]
- .Net 4.8 Support for Windows 10 ends in 26 days?
- Why has the int32 type a maximum value of 2³¹ − 1? [duplicate]
- What is a NullReferenceException, and how do I fix it?
- How do I get a random YouTube video with the YouTube API?
- An existing connection was forcibly closed by the remote host
- What is a NullReferenceException, and how do I fix it?
- I am getting Failed to load resource: net::ERR_BLOCKED_BY_CLIENT with Google chrome
- What’s the difference between .NET Core, .NET Framework, and Xamarin?
- IOException: The process cannot access the file ‘file path’ because it is being used by another process
- ‘Microsoft.ACE.OLEDB.12.0’ provider is not registered on the local machine
- No connection could be made because the target machine actively refused it?
- Could not load file or assembly or one of its dependencies
- What does a lock statement do under the hood?
- Error : Could not load file or assembly or one of it’s dependencies
- Convert int to string?
- Converting string to byte array in C#
- Could not load file or assembly or one of its dependencies
- Multiline string literal in C#
- What is WCF? and what can it do?
- Priority queue in .Net
- What is the difference between int, Int16, Int32 and Int64?
- How can I add ” character to a multi line string declaration in C#?
- What is the purpose of nameof?
- Difference between Delphi and Delphi.NET
- How to open .dll files to see what is written inside?
- Where/how can I download (and install) the Microsoft.Jet.OLEDB.4.0 for Windows 8, 64 bit?
- Convert Enum to String
- Windows .NET API / Windows 7 / Bluetooth communication with Intel Curie Arduino / Genuino 101
- Error 1053 the service did not respond to the start or control request in a timely fashion
- Get current folder path
- foreach vs someList.ForEach(){}
- System.web.mvc missing
- Windows Application has stopped working :: Event Name CLR20r3
- Nullable object must have a value?
- Access to the path is denied
- What is the difference between ASP.NET MVC 6 and ASP.NET Core 1.0 and the reason behind the core framework?
- What does mscorlib stand for?
- Extension methods must be defined in a non-generic static class
- Metadata file ‘.dll’ could not be found
- C# List
to string with delimiter - WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for jquery
- Convert a list of strings to a single string
- “Error while trying to run project: Unable to start program”. Can run program only once. Then VS needs restart
- Add new item in existing array in c#.net
- How to resolve this System.IO.FileNotFoundException
- Embed a System.String in XAML
- What’s the difference between struct and class in .NET?
- What is clr.dll on .Net framework and what does it do?
- what is this oleaut32.dll?
- Associating enums with strings in C#
- How do I declare a DefaultValue attribute whose value is an array of strings?
- Where Is Machine.Config?
- How to resolve this System.IO.FileNotFoundException
- Why does .Net Socket.Disconnect take two minutes?
- HttpWebRequest-The remote server returned an error: (400) Bad Request
- Extension methods must be defined in a non-generic static class
- ClickOnce runtime DFSVC.EXE
- “An attempt was made to load a program with an incorrect format” even when the platforms are the same
- C#: how to get first char of a string?
- How to use the “Using” statement in ASP.net razor webpages?
- How can I get the application’s path in a .NET console application?
- Reading settings from app.config or web.config in .NET
- How do I create a Shared Code project (.shproj)
- How to check if type of a variable is string?
- How to initialize a list of strings (List
) with many string values - There is no argument given that corresponds to the required formal parameter – .NET Error
- What does {0} mean when found in a string in C#?
- How do I remedy “The breakpoint will not currently be hit. No symbols have been loaded for this document.” warning?