Top "Extension-methods" questions

An extension method is a language feature of some languages, such as Swift, Visual Basic.

How do I use an extension method in an ASP.NET MVC View?

How do I access an extension method in an ASP.Net MVC View? In C# I do using MyProject.Extensions; …

asp.net-mvc views extension-methods
How to use unsafe code in safe contex?

I need to use SecureString for a Microsoft's class and i found the following code on the internet: public static …

c# extension-methods unsafe securestring
Specifying constructor constraint for Generic Parameter

I have a collection of objects which I pass as parameter to create objects of another type (one for one). …

c# generics extension-methods type-constraints
@Html.EditorFor(m => m) lambda syntax in MVC

I'm just learning C# and MVC, and trying to understand some examples. @Html.EditorFor(m => m) Eventually I figured …

c# razor lambda extension-methods editorfor
Nullable types in strongly-typed datatables/datasets - workarounds?

Strongly-typed DataTables support "nullable" field types, except that the designer will not allow you change the setting to "allow nulls" …

c# dataset extension-methods nullable strongly-typed-dataset
Extension Methods vs Static Utility Class

I'm looking for some pros and cons for using extension methods over static utility classes in a C# app. For …

c# .net design-patterns extension-methods
Using extension methods in .NET 2.0?

I want to do this, but getting this error: Error 1 Cannot define a new extension method because the compiler required …

c# .net extension-methods
Extension methods versus inheritance

Are there rules of thumb that help determine which to use in what case? Should I prefer one over the …

c# .net class inheritance extension-methods
Null safe way to get values from an IDataReader

(LocalVariable)ABC.string(Name)= (Idatareader)datareader.GetString(0); this name value is coming from database.. what happening here is if this …

c# extension-methods dbnull idatareader
How can I call C# extension methods in VB code

I have a class library with some extension methods written in C# and an old website written in VB. I …

c# vb.net extension-methods class-library