Provide ability to get all relationships with specified schema

This commit is contained in:
Michael Becker 2016-02-05 14:28:00 -05:00
parent 1007b6f6f0
commit 30dd4ad1c3

View File

@ -10,7 +10,20 @@ namespace UniversalEditor.ObjectModels.Package.Relationships
public class RelationshipCollection
: System.Collections.ObjectModel.Collection<Relationship>
{
/// <summary>
/// Gets all <see cref="Relationship" />s with the specified schema.
/// </summary>
/// <param name="schema">The schema to search for.</param>
/// <returns>Array of <see cref="Relationship" /> objects whose Schema property is set to the specified value.</returns>
public Relationship[] GetBySchema(string schema)
{
List<Relationship> rels = new List<Relationship>();
foreach (Relationship rel in this)
{
if (rel.Schema == schema) rels.Add(rel);
}
return rels.ToArray();
}
}
private string mvarID = String.Empty;
@ -22,8 +35,6 @@ namespace UniversalEditor.ObjectModels.Package.Relationships
private string mvarTarget = String.Empty;
public string Target { get { return mvarTarget; } set { mvarTarget = value; } }
public object Clone()
{
Relationship clone = new Relationship();