© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
4 replies
florent

Named tuple on delegate return type [Answered]

I've defined a delegate like this:
public delegate Task<Tuple<TEntity, bool>> AddUpdateCallbackDelegate(TEntity entity, IEnumerable<TEntity> dataSource);
public AddUpdateCallbackDelegate OnAddCallback { get; set; }

...
public async Task Test()
{
    var res = await OnAddCallback(...);
    res.Item1...
    res.Item2...
}
public delegate Task<Tuple<TEntity, bool>> AddUpdateCallbackDelegate(TEntity entity, IEnumerable<TEntity> dataSource);
public AddUpdateCallbackDelegate OnAddCallback { get; set; }

...
public async Task Test()
{
    var res = await OnAddCallback(...);
    res.Item1...
    res.Item2...
}

the return type etc. works just fine, but I want to name the tuple parameters instead of the default
Item1/2
Item1/2
. How could I do that?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Delegate type mismatch
C#CC# / help
3y ago
Create a `Delegate` from a `MethodInfo` [Answered]
C#CC# / help
4y ago
✅ Acces delegate type from another script
C#CC# / help
3y ago
How to return a named predicates
C#CC# / help
4y ago