What does “out” mean before a Generic type parameter?

前端 未结 4 2084
我寻月下人不归
我寻月下人不归 2021-02-05 07:18

I\'ve just saw an unfamiliar syntax while looking for GroupBy return type:

public interface IGrouping : IEnumerable<         


        
4条回答
  •  没有蜡笔的小新
    2021-02-05 07:48

    It is one of the two generic modifiers introduces in C# 4.0 (Visual Studio 2010).

    It signifies that the generic parameter it is declared on is covariant.

    The in modifier signifies the generic parameter it is declared on is contravariant.

    See out (Generic Modifier) and in (Generic Modifier) on MSDN.

提交回复
热议问题