Skip to main content

Questions tagged [extension-method]

1 vote
2 answers
309 views

I have recently stumbled upon a use case of extension methods and wanted to gather some design thoughts. The problem: A IEnumerable of a POCO and within that list there should exist a POCO that ...
Stevenfowler16's user avatar
2 votes
0 answers
67 views

I am a scala developer new to swift. In scala we can share implementation across a variety of classes by "extending" a trait that has default implementations for the methods. I would like to see how ...
WestCoastProjects's user avatar
4 votes
1 answer
2k views

In a recent Pull Request (PR) of mine, a colleague suggested that it was a bad idea to map between a model and its view model via extension methods. I asked why and he said: It isn't how extension ...
J86's user avatar
  • 297
6 votes
4 answers
3k views

So, I've fallen into the fad trap, and started replacing a large amount of linq queries with extension methods. For example: orders.Where(o => o.Status == ShippedStatus.Shipped).Select(o => o....
JohnsonCore's user avatar
0 votes
3 answers
243 views

In a long running Windows Service I have a custom thread pool manager that has a loop which continuously looks through a couple lists for idle threads. Given multiple uses of the same predicate, is ...
rediVider's user avatar
  • 111
0 votes
3 answers
750 views

For the purpose of writing a library, I found to be nice to add types to some well known namespace. Example: I've written a couple of extension methods for BinaryWriter and naturally put them in ...
aybe's user avatar
  • 955
2 votes
1 answer
2k views

I am working to create a C# library that wraps a C DLL to integrate with our test system. The C DLL has probably close to 100 functions that can be accessed and all from the same DLL. I don't need ...
lucasbrendel's user avatar
1 vote
1 answer
344 views

When I find a concrete dependency inside an extension method, I have been attempting to remove the (concrete) dependency by parameterising it like so // original implementation public static List<...
jhsowter's user avatar
  • 491

15 30 50 per page