covariance
Conversion of IEnumerable<T> for Extension Method Issue
I have the following class and extension class (for this example): public class Person<T> { public T Value { get; set; }[详细]
2023-01-06 08:34 分类:问答Is variance of for generic type parameters in C# 4.0 a step closer for higher kind types?
We know that implementing classes are still invariant, despite the fact that their interfa开发者_如何学编程ces are variant. However I am inquiring, is cov/contravariance a step closer to parametric po[详细]
2023-01-03 22:42 分类:问答How is method group overload resolution different to method call overload resolution?
The following code doesn\'t compile (error CS0123: No overload for \'System.Convert.ToString(object)\' matches delegate \'System.Converter<T,string>\'):[详细]
2023-01-03 04:25 分类:问答EF/LINQ: Where() against a property of a subtype
I have a set of POCOs, all of which implement the following simple interface: interface IIdObject { int Id { get; set; }[详细]
2023-01-02 17:57 分类:问答Why aren't classes in .NET 4 covariant? [duplicate]
This question already has answers here: Closed 12 years ago. Possible Duplicate: Why isn’t there generic variance for classes in C# 4.0?[详细]
2023-01-01 20:20 分类:问答C# compiler fails to recognize a class is implementing an interface
The following code fails to compile (using VS2010) and I don\'t see why. The compiler should be able to infer that List<TestClass> is \'compatible\' (sorry for lack of a better word) with IEnume[详细]
2022-12-31 22:27 分类:问答ref and out parameters in C# and cannot be marked as variant
What does the statement mean? From here ref and out parameters in C# and cannot be marked as variant. 1) Does it mean that the following can not be done.[详细]
2022-12-31 05:51 分类:问答Detect variance on generic type parameters of interfaces
Is there a way to refl开发者_Python百科ect on an interface to detect variance on its generic type parameters and return types? In other words, can I use reflection to differentiate between the two int[详细]
2022-12-30 19:10 分类:问答Is is possible to do an end-run around generics covariance in C# < 4 in this hypothetical situation?
Suppose I have a small inheritance hierarchy of Animals: public interface IAnimal { string Speak(); } public class Animal : IAnimal {[详细]
2022-12-30 01:33 分类:问答Is it possible to override a property and return a derived type in VB.NET?
Consider the following classes representing an Ordering system: Public Class OrderBase Public MustOverride Property OrderItem as OrderItemBase[详细]
2022-12-29 07:06 分类:问答
加载中,请稍侯......