3,612 questions
2
votes
1
answer
49
views
Unwrapping an arrow-kt Option in an extension function
I'm in the process of migrating some utility projects our team uses from Arrow 1.2 to 2.x . One of the functions that needs to be updated is an extension function for converting a String into a Date. ...
1
vote
0
answers
61
views
In a chrome extension, I can't create a connection between background and content script files
I am new to developing chrome extensions and I can't create a connection between background and content script files, I have tried so many solutions but nothing worked. I am trapped inside this ...
1
vote
1
answer
57
views
How to extend Array in `f#` so that it could be used by `Seq.sum`
I am trying to make the following code work:
open System.Runtime.CompilerServices
[<Extension>]
type ArrayExtension =
static member inline Zero = Array.replicate 4 0.
[<Extension>...
2
votes
1
answer
79
views
Gets AggregateException on LINQ extension method using LINQKIT
I'm creating a LINQ extension using LINQKIT, but I can't figure out why I get this error
System.AggregateException: One or more errors occurred (no method 'InGroupsImpl on type 'SLT.Assets.Extensions....
0
votes
3
answers
192
views
How to use custom functions on LINQ statement?
I have an extension that returns true or false if value is null (null == false), called HasValueLite().
When I use the method in a LINQ statement, I get:
System.AggregateException: 'One or more errors ...
0
votes
1
answer
71
views
How to build IServiceCollection extension method for a group of services with options?
There are a lot of samples how to group different service registrations for IServiceCollection and move them to an extension method. I couldn't find examples where some of the registered services have ...
0
votes
0
answers
45
views
C# extension methods rules [duplicate]
I'm still newish with C# and I wanted to make sure that my understanding of extension method precedence was correct, so I whipped up some quick tests in LinqPad.
The results all make sense to me ...
5
votes
2
answers
480
views
Extension members for static classes in C# 14
Recently, C# introduced extension members in version 14 (preview).
Can extension methods be written for static classes like Path, File or Directory?
In the previous proposal (roles and extensions), ...
1
vote
1
answer
234
views
Android Studio warning: "Conflict applicable candidates of member and extension" - not sure what to do
I'm running Android Studio Preview versions (currently Android Studio Narwhal | 2025.1.1 Canary 3) & noticed that I'm getting a lot of warnings about conflicts between member functions & ...
0
votes
2
answers
120
views
Any side effects when writing LINQ-like extensions for Task<IEnumerable<T>>?
I'm a little bit annoyed of parentheses in situations like this:
var items = (await SomeService.GetDataAsEnumerableAsync()).ToList();
So I thought of creating an extension method like:
public static ...
0
votes
0
answers
69
views
How to properly write a Kotlin extension for View class that would call either findViewById or requireViewById based on SDK/API version?
I'm forking an Android project to add support for older Android versions. The problem is that the method requireViewById of View class is only available from sdk 28 and I'm trying to go below that, ...
0
votes
1
answer
65
views
Invoke extension method on an instance not a type in Dart
While my question below refers to a specific method - tryParse() - I mean it just as an example, and I look at below as a general problem on class extensions.
Sometimes it would make sense to call ...
0
votes
1
answer
170
views
My ASP project can't access classes from a NuGet package I created
Solution:
As mentioned by @Zhi Lv I had to clear the cache.
Instead of clearing the cache of all packages I choose to go manually to C:\Users\<username>\.nuget\packages\ and delete the folder ...
0
votes
1
answer
96
views
In Scala 3, how to write extension for a dependent or polymorphic function?
So I tried to write an extension view to augment a PolyFunction:
object PolyFnExtension {
type Base[O] = Function1[Any, Any] {
def apply(x: Any): O
}
extension [O](base: Base[O]) {
...
0
votes
1
answer
93
views
Using Generic Type in Extension method
I am writing a generic extension method e.g. AddCors() in my .net aspire project ServiceDefaults to avoid re-writing for each service. However, properties may differ from service to service. Below is ...