My personal collection of CSharp snippets (C#)

About the topic:

Contenido

In this article, I’ll introduce you to my personal collection of C# Code Snippets (CSharp) for the entire Xamarin and Windows environment.

In case you didn’t find out, this post belongs to the Code Snippets #XamarinMonth where a calendar is shared that has a direct link to articles by amazing authors who share their own Snippets. If you haven’t seen it yet, you can see it here.

For a while now I have been creating and saving some custom code snippets for my personal use, for this post I was thinking to share them but I found that the same was already created and can be added with a Visual Studio extension.

For those who don’t know it’s a Code Snippet or those who want to know the list of Snippets that Visual Studio brings by default, I leave them here.

So, with nothing else to say, let’s see what I found. Let’s get started!

Code Snippets

Métodos C#

I have a collection of snippets for C-methods that have helped me quite a bit over time, however, I have found this extension called «C# Methods Code Snippets – for Visual Studio» which has some interesting implementations.

Here’s the list of snippets

  • method (creates a method) and “method1”, “method2”, “method3” creates a method that takes several arguments.
  • vmethod (creates a virtual method) and “vmethod1”, “vmethod2”, “vmethod3” creates a virtual method that takes several arguments.
  • smethod (creates a static method) and “smethod1”, “smethod2”, “smethod3” create a static method that takes several arguments.
  • xmethod (creates a method extension) and “xmethod1”, “xmethod2”, “xmethod3” creates a method extension that takes several arguments.
  • amethod (creates an asynchronous method)
  • asmethod (creates a static asynchronous method)
  • eh (creates a method for event handlers)
  • seh (creates a static method for event handlers)

Regions

I present to you a rather interesting extension that I found by chance, it is called «C# Code Region Snippets». I am a lover of the organization and the truth is that I have everything in Regions and I never thought about creating Snippets to automate and sort our code a little faster.

Regions folder
⚠️ Note: Unfortunately this extension is not compatible with Visual Studio 2019, but you can download the repository snippets here.

Extra

As an extra I wanted to introduce you a rather useful extesion that will help you with this whole snippets theme. I present to you the «Snippet Designer».

The Snippet Designer is an extension that enhances the Visual Studio IDE to enable a richer and more productive Code Snippet experience.

Recommendation

I really have a few more snippets that we use on a day-to-day basis, but these will already be covered by various authors within the Xamarin Code Snippets Calendar of the Month. So I recommend you take a look.

If you want more resources, I recommend going to the resources section where I’m uploading great valuable resources for you.

I hope this post is valuable for you, see you in the next one!

What do you think of this content?
 
Luis Matos

Luis Matos

I help professionals and companies to create value solutions. I am a Systems Engineer, blockchain executive, and international mobile application speaker. Founder of the Malla Consulting Agency and several international technology communities.
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x

Search in the site