src/Misc/EFTools/XmlCore/Model/NormalizedName.cs
/// <summary>
///     Looks in this NameReference for a name part matching
///     oldName. If it finds it replaces oldName with newName
///     in the newBindingString out parameter and returns true, otherwise
///     newBindingString contains the reference as it was originally
///     and returns false.
/// </summary>
/// <returns>true if a replacement is made, otherwise false</returns>
Looks in this NameReference for a name part matching
oldName. If it finds it replaces oldName with newName
in the newBindingString out parameter and returns true, otherwise
newBindingString contains the reference as it was originally
and returns false.
Looks in this NameReference for a name part matching oldName . If it finds it replaces oldName with newName in the newBindingString out parameter and returns true otherwise newBindingString contains the reference as it was originally and returns false .
internal bool ConstructBindingStringWithReplacedNamePart(
            string oldName, string newName, out string newBindingString)
        {
            Debug.Assert(!string.IsNullOrEmpty(oldName), "ConstructBindingStringWithReplacedNamePart(): null or empty oldName");
            Debug.Assert(!string.IsNullOrEmpty(newName), "ConstructBindingStringWithReplacedNamePart(): null or empty newName");
            if (string.IsNullOrEmpty(oldName)
                ||
                string.IsNullOrEmpty(newName))
            {
                newBindingString = null;
                return false;
            }
            if (string.IsNullOrEmpty(_remainingPart)
                ||
                !_remainingPart.Equals(oldName, StringComparison.CurrentCulture))
            {
                newBindingString = ToBindingString();
                return false;
            }
            else
            {
                if (null != _aliasPart)
                {
                    newBindingString = _aliasPart + Symbol.VALID_RUNTIME_SEPARATOR + newName;
                }
                else if (null != _namespacePart)
                {
                    newBindingString = _namespacePart + Symbol.VALID_RUNTIME_SEPARATOR + newName;
                }
                else
                {
                    newBindingString = newName;
                }
                return true;
            }
        }
internal bool ConstructBindingStringWithReplacedNamePart ( string oldName , string newName , out string newBindingString ) { Debug . Assert ( ! string . IsNullOrEmpty ( oldName ) , " " ) ; Debug . Assert ( ! string . IsNullOrEmpty ( newName ) , " " ) ; if ( string . IsNullOrEmpty ( oldName ) || string . IsNullOrEmpty ( newName ) ) { newBindingString = null ; return false ; } if ( string . IsNullOrEmpty ( _remainingPart ) || ! _remainingPart . Equals ( oldName , StringComparison . CurrentCulture ) ) { newBindingString = ToBindingString ( ) ; return false ; } else { if ( null != _aliasPart ) { newBindingString = _aliasPart + Symbol . VALID_RUNTIME_SEPARATOR + newName ; } else if ( null != _namespacePart ) { newBindingString = _namespacePart + Symbol . VALID_RUNTIME_SEPARATOR + newName ; } else { newBindingString = newName ; } return true ; } }
Looks in this NameReference for a name part matching
oldName.
Looks in this NameReference for a name part matching oldName .
// the reference has no name part or it does not match oldName // so no replacement // the reference has a name part which matches oldName // so replace with newName
true if a replacement is made, otherwise false
true if a replacement is made otherwise false
oldName
string
newName
string
string
out