FindProperties

Metadata.FindProperties method

Finds the metadata properties satisfying the specified predicate. The search is recursive so it affects all nested packages as well.

public IEnumerable<MetadataProperty> FindProperties(Func<MetadataProperty, bool> predicate)
Parameter Type Description
predicate Func`2 A function to test each metadata property for a condition.

Return Value

An IEnumerable that contains properties from the package that satisfy the condition.

Remarks

Learn more

Examples

This example demonstrates how to search for specific metadata properties using tags.

using (Metadata metadata = new Metadata(Constants.InputPptx))
{
    // Fetch all the properties satisfying the predicate:
    // property contains the name of the last document editor OR the date/time the document was last modified
    var properties = metadata.FindProperties(p => p.Tags.Contains(Tags.Person.Editor) || p.Tags.Contains(Tags.Time.Modified));
    foreach (var property in properties)
    {
        Console.WriteLine("Property name: {0}, Property value: {1}", property.Name, property.Value);
    }
}

See Also