https://en.wikipedia.org/w/index.php?action=history&feed=atom&title=C_Sharp_%28programming_language%29 C Sharp (programming language) - Revision history 2025-06-29T03:24:00Z Revision history for this page on the wiki MediaWiki 1.45.0-wmf.7 https://en.wikipedia.org/w/index.php?title=C_Sharp_(programming_language)&diff=1294944437&oldid=prev Ajmullen: /* Name */ 2025-06-10T19:08:36Z <p><span class="autocomment">Name</span></p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <col class="diff-marker" /> <col class="diff-content" /> <col class="diff-marker" /> <col class="diff-content" /> <tr class="diff-title" lang="en"> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 19:08, 10 June 2025</td> </tr><tr> <td colspan="2" class="diff-lineno">Line 394:</td> <td colspan="2" class="diff-lineno">Line 394:</td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Its type system is split into two families: Value types, like the built-in numeric types and user-defined structs, which are automatically handed over as copies when used as parameters, and reference types, including arrays, instances of classes, and strings, which only hand over a pointer to the respective object. Due to their special handling of the equality operator and their [[Immutable object|immutability]], strings will nevertheless behave as if they were values, for all practical purposes. You can even use them as [[Switch statement|case]] labels. Where necessary, value types will be [[Boxing (computer science)|boxed]] automatically.&lt;ref&gt;{{cite web|url=https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/types#81-general|title=Types/General, part of the official C# documentation|publisher=[[Microsoft]]|access-date=2024-04-06|archive-date=March 29, 2024|archive-url=https://web.archive.org/web/20240329145803/https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/types#81-general|url-status=live}}&lt;/ref&gt;</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Its type system is split into two families: Value types, like the built-in numeric types and user-defined structs, which are automatically handed over as copies when used as parameters, and reference types, including arrays, instances of classes, and strings, which only hand over a pointer to the respective object. Due to their special handling of the equality operator and their [[Immutable object|immutability]], strings will nevertheless behave as if they were values, for all practical purposes. You can even use them as [[Switch statement|case]] labels. Where necessary, value types will be [[Boxing (computer science)|boxed]] automatically.&lt;ref&gt;{{cite web|url=https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/types#81-general|title=Types/General, part of the official C# documentation|publisher=[[Microsoft]]|access-date=2024-04-06|archive-date=March 29, 2024|archive-url=https://web.archive.org/web/20240329145803/https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/types#81-general|url-status=live}}&lt;/ref&gt;</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>C# supports a strict [[Boolean data type]], &lt;code&gt;bool&lt;/code&gt;. Statements that take conditions, such as &lt;code&gt;while&lt;/code&gt; and &lt;code&gt;if&lt;/code&gt;, require an expression of a type that <del style="font-weight: bold; text-decoration: none;">implements</del> the &lt;code&gt;true&lt;/code&gt; <del style="font-weight: bold; text-decoration: none;">operator, such as the Boolean</del> <del style="font-weight: bold; text-decoration: none;">type</del>. While C++ also has a Boolean type, it can be freely converted to and from integers, and expressions such as &lt;code&gt;if (a)&lt;/code&gt; require only that &lt;code&gt;a&lt;/code&gt; is convertible to bool, allowing &lt;code&gt;a&lt;/code&gt; to be an int, or a pointer. C# disallows this "integer meaning true or false" approach, on the grounds that forcing programmers to use expressions that return exactly &lt;code&gt;bool&lt;/code&gt; can prevent certain types of programming mistakes such as &lt;code&gt;if (a = b)&lt;/code&gt; (use of assignment &lt;code&gt;=&lt;/code&gt; instead of equality &lt;code&gt;==&lt;/code&gt;).</div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>C# supports a strict [[Boolean data type]], &lt;code&gt;bool&lt;/code&gt;. Statements that take conditions, such as &lt;code&gt;while&lt;/code&gt; and &lt;code&gt;if&lt;/code&gt;, require an expression of a type that <ins style="font-weight: bold; text-decoration: none;">evaluates to</ins> the &lt;code&gt;true&lt;/code&gt; <ins style="font-weight: bold; text-decoration: none;">boolean</ins> <ins style="font-weight: bold; text-decoration: none;">value</ins>. While C++ also has a Boolean type, it can be freely converted to and from integers, and expressions such as &lt;code&gt;if (a)&lt;/code&gt; require only that &lt;code&gt;a&lt;/code&gt; is convertible to bool, allowing &lt;code&gt;a&lt;/code&gt; to be an int, or a pointer. C# disallows this "integer meaning true or false" approach, on the grounds that forcing programmers to use expressions that return exactly &lt;code&gt;bool&lt;/code&gt; can prevent certain types of programming mistakes such as &lt;code&gt;if (a = b)&lt;/code&gt; (use of assignment &lt;code&gt;=&lt;/code&gt; instead of equality &lt;code&gt;==&lt;/code&gt;).</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>C# is more [[Type safety|type safe]] than C++. The only [[implicit conversion]]s by default are those that are considered safe, such as widening of integers. This is enforced at compile-time, during [[Just-in-time compilation|JIT]], and, in some cases, at runtime. No implicit conversions occur between Booleans and integers, nor between enumeration members and integers (except for literal 0, which can be implicitly converted to any enumerated type). Any user-defined conversion must be explicitly marked as explicit or implicit, unlike C++ [[copy constructor]]s and conversion operators, which are both implicit by default.</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>C# is more [[Type safety|type safe]] than C++. The only [[implicit conversion]]s by default are those that are considered safe, such as widening of integers. This is enforced at compile-time, during [[Just-in-time compilation|JIT]], and, in some cases, at runtime. No implicit conversions occur between Booleans and integers, nor between enumeration members and integers (except for literal 0, which can be implicitly converted to any enumerated type). Any user-defined conversion must be explicitly marked as explicit or implicit, unlike C++ [[copy constructor]]s and conversion operators, which are both implicit by default.</div></td> </tr> </table> Ajmullen https://en.wikipedia.org/w/index.php?title=C_Sharp_(programming_language)&diff=1293865846&oldid=prev MusikBot II: Adding missing protection template (more info) 2025-06-04T03:20:21Z <p>Adding missing protection template (<a href="/wiki/User:MusikBot_II/FixPP/FAQ" title="User:MusikBot II/FixPP/FAQ">more info</a>)</p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <col class="diff-marker" /> <col class="diff-content" /> <col class="diff-marker" /> <col class="diff-content" /> <tr class="diff-title" lang="en"> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 03:20, 4 June 2025</td> </tr><tr> <td colspan="2" class="diff-lineno">Line 1:</td> <td colspan="2" class="diff-lineno">Line 1:</td> </tr> <tr> <td colspan="2" class="diff-empty diff-side-deleted"></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>{{pp|small=yes}}</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>{{Short description|Programming language}}</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>{{Short description|Programming language}}</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>{{Correct title|title=C#|reason=#}}</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>{{Correct title|title=C#|reason=#}}</div></td> </tr> </table> MusikBot II https://en.wikipedia.org/w/index.php?title=C_Sharp_(programming_language)&diff=1293864877&oldid=prev Materialscientist: Undid revision 1293864835 by 143.105.119.23 (talk) 2025-06-04T03:12:46Z <p>Undid revision <a href="/wiki/Special:Diff/1293864835" title="Special:Diff/1293864835">1293864835</a> by <a href="/wiki/Special:Contributions/143.105.119.23" title="Special:Contributions/143.105.119.23">143.105.119.23</a> (<a href="/wiki/User_talk:143.105.119.23" title="User talk:143.105.119.23">talk</a>)</p> <a href="//en.wikipedia.org/w/index.php?title=C_Sharp_(programming_language)&amp;diff=1293864877&amp;oldid=1293864839">Show changes</a> Materialscientist https://en.wikipedia.org/w/index.php?title=C_Sharp_(programming_language)&diff=1293864839&oldid=prev Materialscientist: Protected "C Sharp (programming language)": Persistent disruptive editing ([Edit=Require autoconfirmed or confirmed access] (expires 03:12, 4 July 2025 (UTC)) [Move=Require autoconfirmed or confirmed access] (expires 03:12, 4 July 2025 (UTC))) 2025-06-04T03:12:28Z <p>Protected &quot;<a href="/wiki/C_Sharp_(programming_language)" title="C Sharp (programming language)">C Sharp (programming language)</a>&quot;: Persistent <a href="/wiki/Wikipedia:Disruptive_editing" title="Wikipedia:Disruptive editing">disruptive editing</a> ([Edit=Require autoconfirmed or confirmed access] (expires 03:12, 4 July 2025 (UTC)) [Move=Require autoconfirmed or confirmed access] (expires 03:12, 4 July 2025 (UTC)))</p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <tr class="diff-title" lang="en"> <td colspan="1" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td> <td colspan="1" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 03:12, 4 June 2025</td> </tr><tr><td colspan="2" class="diff-notice" lang="en"><div class="mw-diff-empty">(No difference)</div> </td></tr></table> Materialscientist https://en.wikipedia.org/w/index.php?title=C_Sharp_(programming_language)&diff=1293864835&oldid=prev 143.105.119.23: made some minor changes 2025-06-04T03:12:27Z <p>made some minor changes</p> <a href="//en.wikipedia.org/w/index.php?title=C_Sharp_(programming_language)&amp;diff=1293864835&amp;oldid=1293864535">Show changes</a> 143.105.119.23 https://en.wikipedia.org/w/index.php?title=C_Sharp_(programming_language)&diff=1293864535&oldid=prev Patient Zero: Reverted edits by 172.56.102.157 (talk) (HG) (3.4.13) 2025-06-04T03:10:08Z <p>Reverted edits by <a href="/wiki/Special:Contributions/172.56.102.157" title="Special:Contributions/172.56.102.157">172.56.102.157</a> (<a href="/wiki/User_talk:172.56.102.157" title="User talk:172.56.102.157">talk</a>) (<a href="/wiki/Wikipedia:HG" class="mw-redirect" title="Wikipedia:HG">HG</a>) (3.4.13)</p> <a href="//en.wikipedia.org/w/index.php?title=C_Sharp_(programming_language)&amp;diff=1293864535&amp;oldid=1293864482">Show changes</a> Patient Zero https://en.wikipedia.org/w/index.php?title=C_Sharp_(programming_language)&diff=1293864482&oldid=prev 172.56.102.157: Undid revision 1293864380 by Joyous! (talk) 2025-06-04T03:09:47Z <p>Undid revision <a href="/wiki/Special:Diff/1293864380" title="Special:Diff/1293864380">1293864380</a> by <a href="/wiki/Special:Contributions/Joyous!" title="Special:Contributions/Joyous!">Joyous!</a> (<a href="/wiki/User_talk:Joyous!" title="User talk:Joyous!">talk</a>)</p> <a href="//en.wikipedia.org/w/index.php?title=C_Sharp_(programming_language)&amp;diff=1293864482&amp;oldid=1293864380">Show changes</a> 172.56.102.157 https://en.wikipedia.org/w/index.php?title=C_Sharp_(programming_language)&diff=1293864380&oldid=prev Joyous!: Reverted 1 edit by 143.105.119.23 (talk) to last revision by John of Reading 2025-06-04T03:09:02Z <p>Reverted 1 edit by <a href="/wiki/Special:Contributions/143.105.119.23" title="Special:Contributions/143.105.119.23">143.105.119.23</a> (<a href="/wiki/User_talk:143.105.119.23" title="User talk:143.105.119.23">talk</a>) to last revision by John of Reading</p> <a href="//en.wikipedia.org/w/index.php?title=C_Sharp_(programming_language)&amp;diff=1293864380&amp;oldid=1293864262">Show changes</a> Joyous! https://en.wikipedia.org/w/index.php?title=C_Sharp_(programming_language)&diff=1293864262&oldid=prev 143.105.119.23: Made some slight grammar changes. 2025-06-04T03:08:16Z <p>Made some slight grammar changes.</p> <a href="//en.wikipedia.org/w/index.php?title=C_Sharp_(programming_language)&amp;diff=1293864262&amp;oldid=1292531885">Show changes</a> 143.105.119.23 https://en.wikipedia.org/w/index.php?title=C_Sharp_(programming_language)&diff=1292531885&oldid=prev John of Reading: /* Property */ Typo fixing, replaced: accesor → accessor 2025-05-27T13:06:46Z <p><span class="autocomment">Property: </span> Typo fixing, replaced: accesor → accessor</p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <col class="diff-marker" /> <col class="diff-content" /> <col class="diff-marker" /> <col class="diff-content" /> <tr class="diff-title" lang="en"> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 13:06, 27 May 2025</td> </tr><tr> <td colspan="2" class="diff-lineno">Line 430:</td> <td colspan="2" class="diff-lineno">Line 430:</td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>===Property===</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>===Property===</div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>C# supports classes with [[property (programming)|properties]]. The properties can be simple <del style="font-weight: bold; text-decoration: none;">accesor</del> functions with a backing field, or implement arbitrary getter and setter functions. A property is read-only if there's no setter. Like with fields, there can be class and instance properties. The underlying methods can be &lt;code&gt;virtual&lt;/code&gt; or [[Abstract method#Abstract methods|&lt;code&gt;abstract&lt;/code&gt;]] like any other method.&lt;ref name="properties" /&gt;</div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>C# supports classes with [[property (programming)|properties]]. The properties can be simple <ins style="font-weight: bold; text-decoration: none;">accessor</ins> functions with a backing field, or implement arbitrary getter and setter functions. A property is read-only if there's no setter. Like with fields, there can be class and instance properties. The underlying methods can be &lt;code&gt;virtual&lt;/code&gt; or [[Abstract method#Abstract methods|&lt;code&gt;abstract&lt;/code&gt;]] like any other method.&lt;ref name="properties" /&gt;</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Since C# 3.0 the [[syntactic sugar]] of auto-implemented properties is available,&lt;ref name="auto-implemented property"&gt;{{cite web|url=https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/auto-implemented-properties|title=Auto-Implemented Properties (C# Programming Guide)|access-date=September 12, 2020|archive-date=October 29, 2020|archive-url=https://web.archive.org/web/20201029204026/https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/auto-implemented-properties|url-status=live}}&lt;/ref&gt; where the [[Mutator method|accessor (getter) and mutator (setter)]] encapsulate operations on a single field of a class.</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Since C# 3.0 the [[syntactic sugar]] of auto-implemented properties is available,&lt;ref name="auto-implemented property"&gt;{{cite web|url=https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/auto-implemented-properties|title=Auto-Implemented Properties (C# Programming Guide)|access-date=September 12, 2020|archive-date=October 29, 2020|archive-url=https://web.archive.org/web/20201029204026/https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/auto-implemented-properties|url-status=live}}&lt;/ref&gt; where the [[Mutator method|accessor (getter) and mutator (setter)]] encapsulate operations on a single field of a class.</div></td> </tr> </table> John of Reading