dotnet / dotnet/csharplang

[Proposal]: Partial Type Inference

Open
#8,968 0 comments 0 reactions 1 assignee Claimed by @RikkiGibson View on GitHub
Proposal champion
Dominant language
C#
Stars
12.7k
Forks
1.1k
Avg merge
11h 1m
Merged PRs (30d)
3

Description

Discussion: https://github.com/dotnet/csharplang/discussions/8967

See #1348
See also #7582

Currently, in an invocation of a generic method, you either have to specify all of the type arguments or none of them, in the latter case depending on the compiler to infer them for you. The proposal is to permit the programmer to provide *some* of the type arguments, and have the compiler infer only those that were not provided.

There are (at least) three possible forms this could take:
1. Named type arguments (#280, #1348), e.g. `M(args)`
2. Omitted type arguments separated by commas, e.g. `M(args)`
3. Types to be inferred specified by `var` (#1348), e.g. `M(args)`

### Design Meetings

https://github.com/dotnet/csharplang/blob/main/meetings/2024/LDM-2024-02-07.md#partial-type-inference

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.