What does the keyword “where” in a class declaration do?

前端 未结 7 1175
天涯浪人
天涯浪人 2020-12-17 17:24

I\'m looking at the source code for the MvcContrib Grid and see the class declared as:

public class Grid : IGrid where T : class

7条回答
  •  难免孤独
    2020-12-17 18:06

    From the Docs http://msdn.microsoft.com/en-us/library/d5x73970.aspx

    where T : class

    The type argument must be a reference type; this applies also to any class, interface, delegate, or array type.

提交回复
热议问题