C#中Chart中的Annotation对象派生自Collection<;>;,但出于某种原因,我不能对其使用.Any()或.Find()方法.
所以这是行不通的:
using System.Windows.Forms.DataVisualization.Charting;
Chart chart = new Chart();
// Your annotation name to search for
string annotationNameToFind = "YourAnnotationName";
// Check if the annotation exists with the given name
bool annotationExists = chart.Annotations.Any(annotation => annotation.Name == annotationNameToFind);
它有一个方法.Containes(),但我不能将Linq与它一起使用.
如何在不使用for或foreach循环的情况下,使用Linq或类似的方法判断图表中的注释是否包含特定的注释名称