tagged [type-inference]

Use of var keyword in C#

Use of var keyword in C# After discussion with colleagues regarding the use of the 'var' keyword in C# 3 I wondered what people's opinions were on the appropriate uses of type inference via var? For e...

3 Feb at 03:25

How can I implement NotOfType<T> in LINQ that has a nice calling syntax?

How can I implement NotOfType in LINQ that has a nice calling syntax? I'm trying to come up with an implementation for `NotOfType`, which has a readable call syntax. `NotOfType` should be the compleme...

Problem understanding C# type inference as described in the language specification

Problem understanding C# type inference as described in the language specification The [C# language specification](http://www.microsoft.com/downloads/en/details.aspx?familyid=DFBF523C-F98C-4804-AFBD-4...

Working around lack of partial generic type inference with constraints

Working around lack of partial generic type inference with constraints I have an interface (which is used by repositories) that has this member: This allows the caller to specify an entity type (`T`) ...

23 May at 11:58

Named arguments and generic type inference in C# 4.0

Named arguments and generic type inference in C# 4.0 I had been programming under the assumption that, when calling a method in C# 4.0, supplying names for your arguments would not affect the outcome ...

Why is C# unable to infer the generic type argument type from a non-generic static method's signature?

Why is C# unable to infer the generic type argument type from a non-generic static method's signature? I have conducted the following inference tests: ``` static class InferenceTest { static void Ta...

8 Oct at 22:6

What is the original type of interpolated string?

What is the original type of interpolated string? MSDN [docs](https://msdn.microsoft.com/en-us/library/dn961160.aspx) contain the section about implicit conversions: From the first string it follows t...

C# generic method type argument not inferred from usage

C# generic method type argument not inferred from usage Recently I've experimented with an implementation of the visitor pattern, where I've tried to enforce Accept & Visit methods with generic interf...

Compile-time error with LINQ Select on IEnumerable<dynamic>

Compile-time error with LINQ Select on IEnumerable --- I have some code like this: in an existing library project targeted at .NET 4.5. VS2015’s IntelliSense underlines the `Text` part, complaining th...

Type inference with class implementing several interfaces of a hierarchy

Type inference with class implementing several interfaces of a hierarchy As an example, let's use something like a calculator with elements of various types, functions that evaluate for different elem...

Partial generic type inference possible in C#?

Partial generic type inference possible in C#? I am working on rewriting my fluent interface for my IoC class library, and when I refactored some code in order to share some common functionality throu...

How can I reliably determine the type of a variable that is declared using var at design time?

How can I reliably determine the type of a variable that is declared using var at design time? I'm working on a completion (intellisense) facility for C# in emacs. The idea is, if a user types a fragm...