Why List(Of T) doesn't have Count()?

前端 未结 4 2125
北荒
北荒 2021-02-15 22:11
Public Class MyList
    Inherits List(Of MyObject)

    Public ReadOnly Property SelectedCount() As Integer
        Get
            Return Me.Count(Function(obj) obj.IsS         


        
4条回答
  •  说谎
    说谎 (楼主)
    2021-02-15 22:52

    To answer #4, this works fine in C#:

    public class MyObject { public bool IsSelected { get { return true; } } }
    
    public class MyList : List
    {
        public int SelectedCount
        {
            get { return this.Count(x => x.IsSelected); }
        }
    }
    

提交回复
热议问题