Ref and Out Keywords in C#

In this article, we will talk about the ref and out keywords in C#.

Introduction:

Before talking about ref and out keyword let`s first talk about how parameters are passed to a method in C#. By default when we pass parameter to a method it is passed by value (copy of the data is passed to a method). But exactly what is copied depends on whether the type is value type or reference type. Int, char, double, decimal, enum etc are built in value types in C# and class, object, delegate, string etc are built in reference types in C#.

Read more

Access Modifiers in C#

In this article, we will talk about access modifiers in C#. Let`s get started.

Introduction:

Encapsulation is one of the pillars of object oriented programming. Encapsulation means ability to hide the unnecessary implementation details from object user. Encapsulation is implemented by using access modifier. Access modifier defines the visibility of type as well as members of type to other part of the application.

Read more

Const vs. Readonly Keywords in C#

In this article, we will talk about two most commonly used keywords “const” and “readonly” and the difference between them. Let`s get started.

Read more

How To Create A NuGet Package

In this article, we will talk about how to create a NuGet package. Before getting started, let`s first talk about what is NuGet?

What is NuGet?

NuGet is free and open-source package manager for the Microsoft Development Platform. It is distributed as visual studio extension. NuGet client tools provide ability to produce and consume packages. As of writing of this article, version of NuGet is 2.8.5. We will create a class library project containing some extension methods for string and then will publish these extension methods as a nuget package. Let`s get started.

Read more

How to Create Custom External Helper Methods in ASP.NET MVC

In this article, we will talk about how to create and use external helper methods in an ASP.NET MVC application. In my post, How to Create Custom Inline Helper Methods in ASP.NET MVC  we talked about what are helper methods and how to create and use inline helper methods in MVC application. (Note: if you have not read the post regarding custom inline helper in MVC application, i will recommend reading it first as it is related to this post). Before getting started with how to create custom external helper methods, let`s just discuss about external helper method and when should we use it.

Read more