We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

IEnumerable vs IEnumerable<T>

StyleCollection inherits the non-generic IEnumerable interface.

I want to see whether a particular Style exists in the collection, but there's no Contains member function.

Do you have any plans to change StyleCollection into the generic IEnumerable which does support Contains? Alternatively, what's the best way, using IEnumerable, to see if a collection contains an object?

Hi Brian,


Thanks for your inquiry. You can use the following simple code to determine if a style exists in Document:

bool flag = false;

foreach (Style style in doc.Styles)

{

if (style.Name.Equals("someStyle"))

{

flag = true;

break;

}

}


Best regards,