3,613 questions
0
votes
1
answer
73
views
C# Error CS9293: Cannot use an extension parameter in this context
I'm experimenting with the new C# 14 extension syntax in .NET 10, and I hit an error I can't find documentation for:
public static class Foo
{
extension(int bar)
{
public static int ...
2
votes
0
answers
107
views
Why do I get a nullability error with this static extension? [duplicate]
I don't understand why the following code creates a warning at compile time:
Can you explain why this is happening? I don't get it.
Min1 is a normal static method with the same signature as Min2. But ...
2
votes
1
answer
51
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
62
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
195
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
79
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 ...
5
votes
2
answers
520
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
242
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
77
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
67
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
179
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
99
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]) {
...