Timeline for answer to What is the difference between String and string in C#? by Derek Park
Current License: CC BY-SA 4.0
Post Revisions
59 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Feb 17 at 17:33 | comment | added | niv | "string" is a c# primary key word (an alias for System.String) like int, long., "String" is defined in .NET base class library System.String. Both refer to the same type. Use "string" for declarations and "String" when call static methods loke String.IsNullOrWhiteSpace(value) | |
| Dec 1, 2025 at 6:16 | comment | added | Douglas Kersey | If you follow StyleCop, it prefers the C# keywords — string over String, int over Int32, and float over Single. | |
| Jun 29, 2024 at 19:25 | comment | added | Roger Hill | Don't assume that StyleCop is somehow the oracle of all knowledge and wisdom, or even always correct. The only thing that it can guarantee is consistency, not quality. | |
| Jan 21, 2023 at 15:30 | comment | added | tbaskan |
Actually this String vs string is not a style only difference. As others pointed out string has a concrete meaning whereas String is normal identifier and all parsing, name resolution rules apply to it. C# compiler lead Jared Parsons has a very well blog post on this subject: blog.paranoidcoding.com/2019/04/08/…
|
|
| Nov 9, 2022 at 19:37 | history | notice removed | Carrott♦ | Recommended answer in AudioBubble | |
| Nov 9, 2022 at 19:37 | history | notice added | AudioBubble | Recommended answer in AudioBubble | |
| Sep 7, 2022 at 17:06 | history | notice removed | Carrott♦ | Recommended answer in AudioBubble | |
| Sep 7, 2022 at 17:05 | history | notice added | AudioBubble | Recommended answer in AudioBubble | |
| Sep 6, 2022 at 19:06 | history | notice removed | Carrott♦ | Recommended answer in AudioBubble | |
| Sep 6, 2022 at 19:06 | history | notice added | AudioBubble | Recommended answer in AudioBubble | |
| Sep 6, 2022 at 19:06 | history | notice removed | Carrott♦ | Recommended answer in AudioBubble | |
| Sep 6, 2022 at 19:06 | history | notice added | AudioBubble | Recommended answer in AudioBubble | |
| Aug 10, 2022 at 13:19 | history | notice removed | whimsea | Recommended answer in AudioBubble | |
| Aug 10, 2022 at 13:18 | history | notice added | AudioBubble | Recommended answer in AudioBubble | |
| Aug 8, 2022 at 12:53 | history | edited | Robert Harvey | CC BY-SA 4.0 |
added 1 character in body
|
| Mar 13, 2022 at 13:10 | comment | added | HootanHT | awsome exploration | |
| Dec 10, 2021 at 5:12 | comment | added | Snap |
I personally like that using the lower case variants (such as string, int etc.) doesn't require importing the System namespace.
|
|
| Aug 31, 2021 at 19:38 | comment | added | user5466135 | it is a bad practice for a language to have two different name for an exact same thing so i suggest microsoft to remove one of them | |
| Aug 25, 2021 at 18:37 | history | edited | user3310334 | CC BY-SA 4.0 |
[Edit removed during grace period]
|
| Jan 13, 2021 at 0:16 | comment | added | John Wu |
It's worth noting that string is not an alias for String but is an alias for global::System.String. When you use the alias, it is guaranteed to resolve to the system string type and not some other class called String.
|
|
| Nov 29, 2020 at 6:50 | comment | added | Rob L | I gues then... Just be conistent. Use string or String or use a cerntain one in a specific case, but always in that case. | |
| Oct 13, 2020 at 21:37 | comment | added | jmoreno | What do you say to the fact that you could define your own type “String” but can’t do the same for “string” as it’s a keyword, as explained in stackoverflow.com/questions/7074/… | |
| Jul 21, 2020 at 18:12 | review | Suggested edits | |||
| Jul 21, 2020 at 19:16 | |||||
| May 7, 2020 at 1:16 | review | Suggested edits | |||
| May 7, 2020 at 5:02 | |||||
| Feb 11, 2020 at 12:21 | review | Suggested edits | |||
| Feb 11, 2020 at 12:52 | |||||
| Jan 22, 2019 at 18:50 | history | edited | Cœur | CC BY-SA 4.0 |
https://docs.microsoft.com/en-us/teamblog/dotnet-api-docs-migration
|
| Aug 7, 2018 at 7:35 | history | edited | Kiran Joshi | CC BY-SA 4.0 |
Remove spaces and define code
|
| Aug 6, 2018 at 22:57 | review | Suggested edits | |||
| Aug 7, 2018 at 0:20 | |||||
| Jul 4, 2018 at 11:03 | history | edited | Kolappan N | CC BY-SA 4.0 |
Updated new URL, changed http to https
|
| Mar 9, 2018 at 11:19 | history | edited | Steven | CC BY-SA 3.0 |
added 4 characters in body
|
| Feb 13, 2018 at 13:52 | history | edited | AidanH | CC BY-SA 3.0 |
General consesus vs opinion
|
| May 23, 2017 at 11:55 | history | edited | URL Rewriter Bot |
replaced http://stackoverflow.com/ with https://stackoverflow.com/
|
|
| S May 8, 2017 at 19:21 | history | suggested | Prayag Sagar | CC BY-SA 3.0 |
Updated StyleCop hyperlink to point at GitHub
|
| May 8, 2017 at 13:00 | review | Suggested edits | |||
| S May 8, 2017 at 19:21 | |||||
| Jan 29, 2017 at 18:10 | history | edited | Sophie Swett | CC BY-SA 3.0 |
Remove confusing, wrong-ish paragraph about `int` "defaulting" to `Int32`
|
| Aug 11, 2016 at 5:04 | history | edited | Chandan Kumar | CC BY-SA 3.0 |
Highlighted codes and modified the format
|
| Jul 2, 2016 at 19:10 | history | edited | Mikael Puusaari | CC BY-SA 3.0 |
clarified a bit of types
|
| Jan 7, 2016 at 0:38 | history | edited | Cristian Ciupitu | CC BY-SA 3.0 |
added links to documentation
|
| Nov 20, 2015 at 11:12 | history | edited | IanGSY | CC BY-SA 3.0 |
removed -
|
| May 28, 2015 at 0:33 | history | edited | James Newton-King | CC BY-SA 3.0 |
Typo
|
| May 27, 2015 at 23:44 | history | edited | James Newton-King | CC BY-SA 3.0 |
added 8 characters in body
|
| Dec 22, 2014 at 5:21 | comment | added | Sami Kuhmonen | Visual Studio 2015 says that String.Format should be changed to string.Format, so I guess Microsoft is going that way. I have also always used String for the static methods. | |
| Sep 18, 2014 at 14:55 | history | edited | Philipp M | CC BY-SA 3.0 |
Changed to colored code highlighting for better visual difference
|
| Aug 26, 2013 at 10:12 | history | edited | Oleksiy | CC BY-SA 3.0 |
code quotes added, new line fixed
|
| Aug 13, 2013 at 21:16 | history | edited | cvsguimaraes | CC BY-SA 3.0 |
Examples link updated
|
| Jul 30, 2013 at 9:53 | history | edited | Arun Bertil | CC BY-SA 3.0 |
formatting
|
| May 31, 2013 at 3:15 | review | Suggested edits | |||
| May 31, 2013 at 3:16 | |||||
| Mar 15, 2013 at 18:30 | history | edited | Daniel | CC BY-SA 3.0 |
Added link to StyleCop.
|
| Oct 12, 2012 at 23:25 | comment | added | Rob | I always use the aliases because I've assumed one day it might come in handy because they are acting as an abstraction, so therefore can have their implementations changed without me having to know. | |
| Oct 4, 2012 at 10:37 | history | made wiki | Post Made Community Wiki by Inverted Llama | ||
| May 23, 2012 at 15:51 | history | edited | Derek Park | CC BY-SA 3.0 |
added 129 characters in body
|
| May 22, 2012 at 22:36 | comment | added | Dominic Zukiewicz | If you decide to use StyleCop and follow that, that will say to use the types specific to the language. So for C# you'll have string (instead of String), int (instead of Int32), float (instead of Single) - stylecop.soyuz5.com/SA1121.html | |
| Jun 21, 2009 at 10:23 | history | edited | Robert MacLean | CC BY-SA 2.5 |
linking it to the int vs. int32 question
|
| Aug 10, 2008 at 9:10 | history | edited | Derek Park | CC BY-SA 2.5 |
ugly typo
|
| Aug 10, 2008 at 8:47 | vote | accept | Lance Fisher | ||
| Aug 10, 2008 at 8:20 | history | edited | Jeff Atwood | CC BY-SA 2.5 |
change italics to backtick (code marker)
|
| Aug 10, 2008 at 7:36 | history | edited | Derek Park | CC BY-SA 2.5 |
added link to MS example
|
| Aug 10, 2008 at 7:31 | history | edited | Derek Park | CC BY-SA 2.5 |
added examples
|
| Aug 10, 2008 at 7:22 | history | answered | Derek Park | CC BY-SA 2.5 |