What is the difference between Contains and Any in LINQ?

前端 未结 5 1550
孤独总比滥情好
孤独总比滥情好 2020-11-30 08:49

What is the difference between Contains and Any in LINQ?

5条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-30 08:57

    Contains

    Determines whether a sequence contains a specified element by using the default equality comparer.

    Any

    Determines whether a sequence contains any elements.

    As for the documentation:

    Can't seem to find to find any documentation on it.

    All (most?) LINQ extension methods: here

提交回复
热议问题