Skip to content

Commit

Permalink
Added Get and Set methods to TreeNode
Browse files Browse the repository at this point in the history
  • Loading branch information
rappen committed Aug 6, 2023
1 parent 9030b63 commit b99b0bd
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion FetchXmlBuilder/Builder/TreeNodeHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace Rappen.XTB.FetchXmlBuilder.Builder
{
internal class TreeNodeHelper
internal static class TreeNodeHelper
{
/// <summary>
/// Reuses an existing node in a tree to represent a new FetchXML item
Expand Down Expand Up @@ -590,5 +590,28 @@ private static List<string> GetEntitysChilds(XmlNode ent)
}
return result;
}

internal static void SetNodeAttributeValue(this TreeNode node, string attribute, string value)
{
var collec = (Dictionary<string, string>)node.Tag;
if (collec.ContainsKey(attribute))
{
collec[attribute] = value;
}
else
{
collec.Add(attribute, value);
}
}

internal static string GetNodeAttributeValue(this TreeNode node, string attribute)
{
var collec = (Dictionary<string, string>)node.Tag;
if (collec.ContainsKey(attribute))
{
return collec[attribute];
}
return null;
}
}
}

0 comments on commit b99b0bd

Please sign in to comment.