Top "Extension-methods" questions

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

Does Array.ToArray<>() return the original array if it is the same type?

I deal with a framework on a daily basis where we sometimes provide methods that accept IEnumerable<MyBusinessObject> …

c# linq extension-methods
Disadvantages of extension methods?

Extension method is a really helpful feature that you can add a lot of functions you want in any class. …

c# extension-methods
VB.NET: impossible to use Extension method on System.Object instance

Can I make an Extension method for all the subclasses of System.Object (everything)? Example: <Extension> Public Function …

.net vb.net object extension-methods late-binding
Extending XUnit Assert class with new asserts

I'm trying to extend the xUnit assert method by adding some selenium functionality namespace MyProject.Web.Specs.PageLibrary.Extensions { public …

c# extension-methods assert xunit.net
Why doesn't EnumerableRowCollection<DataRow>.Select() compile like this?

This works: from x in table.AsEnumerable() where x.Field<string>("something") == "value" select x.Field<decimal&…

c# linq select extension-methods linq-to-dataset
Contains method for compare string array in C#

I want to compare a sting field with a string array using LINQ, I’ve written the below extension method …

c# linq entity-framework extension-methods linq-expressions
Extension methods defined on value types cannot be used to create delegates - Why not?

Extension methods can be assigned to delegates that match their usage on an object, like this: static class FunnyExtension { public …

c# .net extension-methods delegates value-type