Two Ways Of Setting Substring Values - Inconsistency Follow

0
Avatar
Legacy Poster

There are two ways of setting Named SubString values which yields the same printed labels, but have different behavior.

 

I use the following function to add user input, labelData, to set the template with Names Substrings.

 

        protected override void SetLabelData(IDictionary<string, object> labelData)

        {

 

            SubStrings subStrings = LabelFormat.SubStrings;

            foreach (var substr in subStrings.Where(substr => labelData.ContainsKey(substr.Name)))

            {

 

                //the side-effects of the following two statements are different...

                //this one adds the values to the m_cachedSubStringsList, List<SubString>; but does not change the XML

                subStrings.SetSubString(substr.Name, labelData[substr.Name].ToString());

 

                //this one changes the XML, but does not add to the m_cachedSubStringsList.

 

                //substr.Value = labelData[substr.Name].ToString();

            }

        }

What I am looking for is a consistent way to determine if any substring value has been set. Any suggestions?

 

Please sign in to leave a comment.