Skip to content

Using ExtensionsDotNet

Adrian Gabor edited this page Nov 12, 2021 · 6 revisions

Add the following using statement in any class you want to use ExtensionsDotNet:

using Extensions.net;


All ExtensionDotNet extension methods end in Ext. When using Visual Studio, In order to easily see all the available methods without having to parse through all the .NET methods, type .Ext after your object and Intellisense will filter only the extension methods that contain Ext.

string str = "some string value";
str.Ext...

For ASP.NET web apps, the easiest way to make ExtensionsDotNet available to all of your web pages (MVC views and razor pages) is to add the Extensions.nst namespace to _ViewImports.cshtml.

@using WebApplication1
@using WebApplication1.Models
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

@using Extensions.net

As of C# 10.0, available in .NET 6 and higher, you can now declare global using directives by adding global before a using statement. For more information on global using directives, refer to the Microsoft Docs.

global using Extensions.net;
Clone this wiki locally