{"id":20409467,"url":"https://github.com/jsakamoto/csharpmethodscodesnippets","last_synced_at":"2025-04-12T15:51:17.432Z","repository":{"id":28240940,"uuid":"31746283","full_name":"jsakamoto/CSharpMethodsCodeSnippets","owner":"jsakamoto","description":"Code snippets for C# methods.","archived":false,"fork":false,"pushed_at":"2021-09-21T11:00:26.000Z","size":361,"stargazers_count":47,"open_issues_count":1,"forks_count":8,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-26T10:21:15.626Z","etag":null,"topics":["c-sharp","csharp","snippets","visual-studio"],"latest_commit_sha":null,"homepage":"https://marketplace.visualstudio.com/items?itemName=jsakamoto.CMethodsCodeSnippets","language":"Vim Snippet","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jsakamoto.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-03-06T01:27:15.000Z","updated_at":"2024-12-31T21:06:11.000Z","dependencies_parsed_at":"2022-09-04T13:00:28.974Z","dependency_job_id":null,"html_url":"https://github.com/jsakamoto/CSharpMethodsCodeSnippets","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsakamoto%2FCSharpMethodsCodeSnippets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsakamoto%2FCSharpMethodsCodeSnippets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsakamoto%2FCSharpMethodsCodeSnippets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsakamoto%2FCSharpMethodsCodeSnippets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jsakamoto","download_url":"https://codeload.github.com/jsakamoto/CSharpMethodsCodeSnippets/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248591943,"owners_count":21130152,"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":["c-sharp","csharp","snippets","visual-studio"],"created_at":"2024-11-15T05:42:00.471Z","updated_at":"2025-04-12T15:51:17.395Z","avatar_url":"https://github.com/jsakamoto.png","language":"Vim Snippet","funding_links":[],"categories":[],"sub_categories":[],"readme":"# C# Methods Code Snippets - for Visual Studio\n\n## Summary\n\nThis is code snippets for appending method in C# code, for Visual Studio 2012 or above.\n\n## How to install?\n\nDownload \"C# Methods Code Snippets\" Visual Studio Extension file (.vsix) from [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=jsakamoto.CMethodsCodeSnippets), and open it.\n\nYou can also install via Visual Studio [Tools] \u003e [Extensions and Updates] dialog (search with keyword \"method\").\n\n![fig.1](https://raw.githubusercontent.com/jsakamoto/CSharpMethodsCodeSnippets/master/.assets/fig001.png)\n\n## How to use?\n\nAfter installing of this snippet, you can use following code snippet shortcuts.\n\n- **method** (snippet for instance method)\n    - and \"method1\", \"method2\", \"method3\" are taking arguments edition. \n- **imethod** (snippet for interface method)\n    - and \"imethod1\", \"imethod2\", \"imethod3\" are taking arguments edition. \n- **vmethod** (snippet for virtual instance method)\n    - and \"vmethod1\", \"vmethod2\", \"vmethod3\" are taking arguments edition. \n- **smethod** (snippet for static method)\n    - and \"smethod1\", \"smethod2\", \"smethod3\" are taking arguments edition. \n- **xmethod** (snippet for extension method)\n    - and \"xmethod1\", \"xmethod2\", \"xmethod3\" are taking arguments edition. \n- **amethod** (snippet for an async instance method)\n- **asmethod** (snippet for an async static method)\n- **eh** (snippet for event handler method)\n- **seh** (snippet for event handler static method)\n\n## Examples\n\n### ex.1) Instance method\n\n```csharp\n// Enter \"method [Tab]\", then...  \npublic void MyMethod()  {\n    throw new NotImplementedException();\n}\n\n// Enter \"method1 [Tab]\", then...  \npublic void MyMethod(object arg)  {\n    throw new NotImplementedException();\n}\n\n// Enter \"method2 [Tab]\", then...  \npublic void MyMethod(object arg1, object arg2)  {\n    throw new NotImplementedException();\n}\n\n// Enter \"method3 [Tab]\", then...  \npublic void MyMethod(object arg1, object arg2, object arg3)  {\n    throw new NotImplementedException();\n}\n```\n### ex.2) Interface method\n\n```csharp\n// Enter \"imethod [Tab]\", then...  \npublic void MyMethod();\n\n// Enter \"imethod1 [Tab]\", then...  \npublic void MyMethod(object arg);\n\n// Enter \"imethod2 [Tab]\", then...  \npublic void MyMethod(object arg1, object arg2);\n\n// Enter \"imethod3 [Tab]\", then...  \npublic void MyMethod(object arg1, object arg2, object arg3);\n```\n\n### ex.3) Virtual instance method\n\n```csharp\n// Enter \"vmethod [Tab]\", then...  \npublic virtual void MyMethod()  {\n    throw new NotImplementedException();\n}\n\n// Enter \"vmethod1 [Tab]\", then...  \npublic virtual void MyMethod(object arg)  {\n    throw new NotImplementedException();\n}\n\n// Enter \"vmethod2 [Tab]\", then...  \npublic virtual void MyMethod(object arg1, object arg2)  {\n    throw new NotImplementedException();\n}\n\n// Enter \"vmethod3 [Tab]\", then...  \npublic virtual void MyMethod(object arg1, object arg2, object arg3)  {\n    throw new NotImplementedException();\n}\n```\n\n### ex.4) Static method\n\n```csharp\n// Enter \"smethod [Tab]\", then...  \npublic static void MyMethod()  {\n    throw new NotImplementedException();\n}\n\n// Enter \"smethod1 [Tab]\", then...  \npublic static void MyMethod(object arg)  {\n    throw new NotImplementedException();\n}\n\n// Enter \"smethod2 [Tab]\", then...  \npublic static void MyMethod(object arg1, object arg2)  {\n    throw new NotImplementedException();\n}\n\n// Enter \"smethod3 [Tab]\", then...  \npublic static void MyMethod(object arg1, object arg2, object arg3)  {\n    throw new NotImplementedException();\n}\n```\n### ex.5) Extension method\n\n```csharp\n// Enter \"xmethod [Tab]\", then...  \npublic static void MyMethod(this object value)  {\n    throw new NotImplementedException();\n}\n\n// Enter \"xmethod1 [Tab]\", then...  \npublic static void MyMethod(this object value, object arg)  {\n    throw new NotImplementedException();\n}\n\n// Enter \"xmethod2 [Tab]\", then...  \npublic static void MyMethod(this object value, object arg1, object arg2)  {\n    throw new NotImplementedException();\n}\n\n// Enter \"xmethod3 [Tab]\", then...  \npublic static void MyMethod(this object value, object arg1, object arg2, object arg3)  {\n    throw new NotImplementedException();\n}\n```\n\n### ex.6) Async instance method\n\n```csharp\n// Enter \"amethod [Tab]\", then...  \npublic async Task\u003cobject\u003e MyMethodAsync()  {\n    throw new NotImplementedException();\n}\n```\n\n### ex.7) Async static method\n\n```csharp\n// Enter \"asmethod [Tab]\", then...  \npublic static async Task\u003cobject\u003e MyMethodAsync()  {\n    throw new NotImplementedException();\n}\n```\n\n### ex.8) Event handler, Static event handler\n\n```csharp\n// Enter \"eh [Tab]\", then... \nprivate void MyMethod(object sender, EventArgs e)\n{\n    throw new NotImplementedException();\n}\n```\n\n```csharp\n// Enter \"seh [Tab]\", then... \nprivate static void MyMethod(object sender, EventArgs e)\n{\n    throw new NotImplementedException();\n}\n```\n\n## License\n\n[GNU GPL v.3](LICENSE.txt)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsakamoto%2Fcsharpmethodscodesnippets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjsakamoto%2Fcsharpmethodscodesnippets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsakamoto%2Fcsharpmethodscodesnippets/lists"}