{"id":13459653,"url":"https://github.com/lifeparticle/C-Sharp-Cheatsheet","last_synced_at":"2025-03-24T18:31:00.418Z","repository":{"id":62082074,"uuid":"440365146","full_name":"lifeparticle/C-Sharp-Cheatsheet","owner":"lifeparticle","description":"C#-Cheatsheet","archived":false,"fork":false,"pushed_at":"2024-05-15T09:37:47.000Z","size":64,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-10-29T05:34:53.534Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lifeparticle.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["lifeparticle"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2021-12-21T02:22:09.000Z","updated_at":"2024-05-15T09:37:51.000Z","dependencies_parsed_at":"2024-10-29T05:41:31.216Z","dependency_job_id":null,"html_url":"https://github.com/lifeparticle/C-Sharp-Cheatsheet","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lifeparticle%2FC-Sharp-Cheatsheet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lifeparticle%2FC-Sharp-Cheatsheet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lifeparticle%2FC-Sharp-Cheatsheet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lifeparticle%2FC-Sharp-Cheatsheet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lifeparticle","download_url":"https://codeload.github.com/lifeparticle/C-Sharp-Cheatsheet/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245328129,"owners_count":20597364,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T10:00:24.017Z","updated_at":"2025-03-24T18:31:00.124Z","avatar_url":"https://github.com/lifeparticle.png","language":null,"funding_links":["https://github.com/sponsors/lifeparticle"],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"readme":"- [Introduction](#introduction)\n- [Installation](#installation)\n- [Reserved Words](#reserved-words)\n- [Comment](#comment)\n- [Operators](#operators)\n- [Variables and Scope](#variables-and-scope)\n- [Conditional structures](#conditional-structures)\n- [Data types](#data-types)\n- [Array](#array)\n- [Hash](#hash)\n- [Loop](#loop)\n- [Classes](#classes)\n- [Miscellaneous](#miscellaneous)\n- [My C# Articles](#my-c%23-articles)\n- [Books and other resources](#books-and-other-resources)\n- [Bug Reports and Feature Requests](#bug-reports-and-feature-requests)\n- [Contribution Guidelines](#contribution-guidelines)\n\n# Introduction\n\nC# (pronounced \"See Sharp\") is a strongly-typed programming language developed by Microsoft in 2002. \n\n## C# versions\n\n```\n1.0, 1.2, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 7.1, 7.2, 7.3, 8.0, 9, 10\n```\n\n# Installation\n\nTODO\n\n\n# Key Words\n\n```cs\nabstract, as, base, bool, break, byte, case, catch, char, checked, class, const, continue, decimal,\ndefault, delegate, do, double, else, enum, event, explicit, extern, false, finally, fixed, float,\nfor, foreach, goto, if, implicit, in, int, interface, internal, is, lock, long, namespace, new,\nnull, object, operator, out, override, params, private, protected, public, readonly, ref, return,\nsbyte, sealed, short, sizeof, stackalloc, static, string, struct, switch, this, throw,\ntrue, try, typeof, uint, ulong, unchecked, unsafe, ushort, using, virtual, void, volatile, while\n```\n\n# Naming conventions\n\n\n|   Name     |  Types |     Example         |\n|------|------|------|\n|  camelCase      |   variables, parameters     | studentName |\n|  pascalCase      |   classes, methods, fields          |  StdentName | \n|  IPascalCase      |  interfaces      | IStdentName  |\n| \\_camelCase   |   private fields      |   \\_studentName | \n\n\n# Comment\n\n\n# Operators\n\n\n\u003ctable\u003e\n\u003ctr\u003e\n\u003cth\u003eBoolean logical operators\u003c/th\u003e\n\u003cth\u003eBitwise and shift operators\u003c/th\u003e\n\u003cth\u003eArithmetic operators\u003c/th\u003e\n\u003cth\u003eEquality operators\u003c/th\u003e\n\u003cth\u003eComparison operators\u003c/th\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\n\u003ctd valign=\"top\"\u003e\n\n| No  | Operator |\n| --- | -------- |\n| 1   | \u0026|\n| 2   |  \\|       |\n| 3   | ^ |\n| 4   | \u0026\u0026       |\n| 5   | \\|\\|     |\n| 6   | !        |\n\n\u003c/td\u003e\n\n\u003ctd valign=\"top\"\u003e\n\n| No  | Operator |\n| --- | -------- |\n| 1   | \u0026        |\n| 2   | \\|       |\n| 3   | ^        |\n| 4   | ~        |\n| 5   | \u003c\u003c       |\n| 6   | \u003e\u003e       |\n| 7   | \u003e\u003e\u003e       |\n\n\u003c/td\u003e\n\n\u003ctd valign=\"top\"\u003e\n\n| No  | Operator |\n| --- | -------- |\n| 1   | +        |\n| 2   | -        |\n| 3   | \\*       |\n| 4   | /        |\n| 5   | %        |\n| 6   | \\+\\+     |\n| 7   | \\-\\-     |\n\n\u003c/td\u003e\n\n\u003ctd valign=\"top\"\u003e\n\n| No  | Operator |\n| --- | -------- |\n| 1   | ==        |\n| 2   | !=       |\n\n\n\u003c/td\u003e\n\n\u003ctd valign=\"top\"\u003e\n\n| No  | Operator |\n| --- | -------- |\n| 1   | \u003e        |\n| 2   | \u003c        |\n| 3   | \u003e=       |\n| 4   | \u003c=       |\n\n\n\u003c/td\u003e\n\n\u003c/tr\u003e\u003c/table\u003e\n\n\n\n\n# Variables and Scope\n\n| No | Name    | Example                     | Doc                                                                                                                       | Data Type | .NET type      |\n|----|---------|-----------------------------|---------------------------------------------------------------------------------------------------------------------------|-----------|----------------|\n| 1  | bool    | `bool isVisible = true;`    | [link](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/bool)                             | value     | System.Boolean |\n| 2  | byte    | `System.Int32 a = 123;`     | [link](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/integral-numeric-types)           | value     | System.Byte    |\n| 3  | sbyte   | `System.Int32 a = 123;`     | [link](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/integral-numeric-types)           | value     | System.SByte   |\n| 4  | char    | `char a = 'A';`             | [link](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/char)                             | value     | System.Char    |\n| 5  | decimal | `double a = 1.1;`           | [link](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/floating-point-numeric-types)     | value     | System.Decimal |\n| 6  | double  | `double a = 1.1;`           | [link](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/floating-point-numeric-types)     | value     | System.Double  |\n| 7  | float   | `double a = 1.1;`           | [link](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/floating-point-numeric-types)     | value     | System.Single  |\n| 8  | int     | `System.Int32 a = 123;`     | [link](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/auiltin-types/integral-numeric-types)           | value     | System.Int32   |\n| 9  | uint    | `System.Int32 a = 123;`     | [link](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/auiltin-types/integral-numeric-types)           | value     | System.UInt32  |\n| 10 | nint    | `System.Int32 a = 123;`     | [link](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/auiltin-types/integral-numeric-types)           | value     | System.IntPtr  |\n| 11 | nuint   | `System.Int32 a = 123;`     | [link](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/auiltin-types/integral-numeric-types)           | value     | System.UIntPtr |\n| 12 | long    | `System.Int32 a = 123;`     | [link](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/auiltin-types/integral-numeric-types)           | value     | System.Int64   |\n| 13 | ulong   | `System.Int32 a = 123;`     | [link](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/auiltin-types/integral-numeric-types)           | value     | System.UInt64  |\n| 14 | short   | `System.Int32 a = 123;`     | [link](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/auiltin-types/integral-numeric-types)           | value     | System.Int16   |\n| 15 | ushort  | `System.Int32 a = 123;`     | [link](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/integral-numeric-types)           | value     | System.UInt16  |\n| 16 | object  | `string a = \"hello world\";` | [link](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/reference-types#the-object-type)  | reference     | System.Object  |\n| 17 | string  | `string a = \"hello world\";` | [link](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/reference-types#the-string-type)  | reference     | System.String  |\n| 18 | dynamic | `dynamic a = 1;`            | [link](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/reference-types#the-dynamic-type) | reference     | System.Object  |\n\n\n## Difference between var and dynamic\n\n# Conditional structures\n\n# Data types\n\nHow to check the data type\n\n# Array\n\n# Hash\n\n# Loop\n\n# Classes\n\n# Miscellaneous\n\n1. Format JSON\n\n```csharp\nConsole.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(data[i], Newtonsoft.Json.Formatting.Indented));\n```\n\n2.\n\n# My C# Articles\n\n# Books and other resources\n1. https://github.com/dotnet/core\n\n# Bug Reports and Feature Requests\n\n# Contribution Guidelines\n\n# Resources\n\n1. [Engineering@Microsoft Blog](https://devblogs.microsoft.com/engineering-at-microsoft/welcome-to-the-engineering-at-microsoft-blog/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flifeparticle%2FC-Sharp-Cheatsheet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flifeparticle%2FC-Sharp-Cheatsheet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flifeparticle%2FC-Sharp-Cheatsheet/lists"}