From 30dd4ad1c39a408e315143ff0e91b397316ce323 Mon Sep 17 00:00:00 2001 From: alcexhim Date: Fri, 5 Feb 2016 14:28:00 -0500 Subject: [PATCH] Provide ability to get all relationships with specified schema --- .../Package/Relationships/Relationship.cs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/ObjectModels/Package/Relationships/Relationship.cs b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/ObjectModels/Package/Relationships/Relationship.cs index 81e893d9..f1c989af 100644 --- a/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/ObjectModels/Package/Relationships/Relationship.cs +++ b/CSharp/Plugins/UniversalEditor.Plugins.Microsoft/ObjectModels/Package/Relationships/Relationship.cs @@ -10,7 +10,20 @@ namespace UniversalEditor.ObjectModels.Package.Relationships public class RelationshipCollection : System.Collections.ObjectModel.Collection { - + /// + /// Gets all s with the specified schema. + /// + /// The schema to search for. + /// Array of objects whose Schema property is set to the specified value. + public Relationship[] GetBySchema(string schema) + { + List rels = new List(); + 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();