I want to write a single function that can add certain fields to Firebase message structs. There are two different types of message, Message and Multi ...
I want to write a single function that can add certain fields to Firebase message structs. There are two different types of message, Message and Multi ...
I am using MediatR. Requests are decorated like so public record GetUserInfoQuery(Guid id) : IRequest<GetUserInfoResponse>; public record GetUs ...
I'm trying to make a helper that allows asynchronously chaining side effects, but I'm unable to get the generic bounds correct so that the compiler un ...
Given public class BaseClass that has derived classes, where a number of those follow the form public class DerivedClass : BaseClass, ISpecificInter ...
I'm trying to create an interface that will add a column to a database entity which will be used the track the user making changes. The interface w ...
I need to create an interface with 2 type and use it as a method return value. ...
Let's say I have a generic class and I want to declare final class as that seems to be possible, but what if I want to complicate the task and a ...
The very-well known constraint in generic types is new(), it is possible to add parameters like (args,args,...) to force the compiler to check that th ...
I have a situation where the generic type is constraint by a union type, but I find that doing this does not make the type narrowing to work as expect ...
I need to inherit a collection of items of the current type, like this This mostly works as expected. The problem is I can do something like this ...
Full signature of method: I'm learning lambda expressions and I have this piece of code that compare a List of employees and order them by the name ...
In TypeScript this is not compiling: Particularly, the Generic<T[P]> fails with Type 'T[P]' does not satisfy the constraint 'string'.. Howeve ...
I have this class, it's part of my specification pattern. Following this link and BaseEntity consists of just the id ex. and this works fine fo ...
TL;DR: 1) A non-generic version of my code allows me to cast an object to an interface that I know it implements; a generic version, where I'm casting ...
I have a generic struct allowing different types to be used. I do not want to constrain the whole struct to only Decodable items. What is the best wa ...
The task is to write an alter query for general constraints. Specifically: "In Employee, if EmployeeLevel is NULL, then EmployeeSalary must also be NU ...
Consider the following code: Note the error on the second line, claiming that P is not a class type. However, on line 1, P is declared to extend An ...
I'm trying to write a function getDocument which would do the following: I've been trying many different combinations of generic signatures for get ...
This is my Typescript interface/class structure that I have: I would like to provide the defaults so that I don't have provide concrete types for m ...
I have the following method: public void SomeMethod<TParser, T1, T2> () where TParser : IParser<T1, T2>, new() { ... } and an IPars ...