在将内容添加到 ListBox 之前,我试图从 List 中删除与特定条件匹配的几个项目。我想要从列表中删除(枚举)“MediaState.Deleted”的任何内容。
到目前为止,我已经尝试过:
//does not remove anything
dbAssetList.RemoveAll(x => x.MediaState.Equals(6));
//Error on .equals which states that "Cannot access static method equals in non-static context"
dbAssetList.RemoveAll(x => x.MediaState.Equals(typeof(MediaState),MediaState.Deleted));
//Error on .equals which states that "Cannot access static method equals in non-static context"
dbAssetList.RemoveAll(x => dbAssetList.Contains(x.MediaState.Equals(typeof(MediaState), MediaState.Deleted)));
我做错了什么,如何删除列表中“MediaState.Deleted”的项目