3rdparty/NRefactory/ICSharpCode.NRefactory.CSharp.Refactoring/CodeIssues/Synced/ConstraintViolations/InconsistentNamingIssue/NamingRule.cs
/// <summary>
/// Applies a suffix to a name and tries to reuse the suffix of the suffix.
/// MyArgs + EventArgs -> MyEventArgs instead of MyArgsEventArgs
/// </summary>
Applies a suffix to a name and tries to reuse the suffix of the suffix.
Applies a suffix to a name and tries to reuse the suffix of the suffix .
static string ApplySuffix(string name, string suffix)
		{
			var words = WordParser.BreakWords(suffix);
			bool found = false;
			for (int j = words.Count - 1; j >= 0; j--) {
				if (name.EndsWith(words[j], StringComparison.Ordinal)) {
					name = name.Substring(0, name.Length - words[j].Length);
					found = true;
				} else {
					if (found)
						return name + string.Join("", words.ToArray(), j, words.Count - j);
					break;
				}
			}
			return name + suffix;
		}
static string ApplySuffix ( string name , string suffix ) { var words = WordParser . BreakWords ( suffix ) ; bool found = false ; for ( int j = words . Count - 1 ; j >= 0 ; j -- ) { if ( name . EndsWith ( words [ j ] , StringComparison . Ordinal ) ) { name = name . Substring ( 0 , name . Length - words [ j ] . Length ) ; found = true ; } else { if ( found ) return name + string . Join ( " " , words . ToArray ( ) , j , words . Count - j ) ; break ; } } return name + suffix ; }
Applies a suffix to a name and tries to reuse the suffix of the suffix.
Applies a suffix to a name and tries to reuse the suffix of the suffix .
name
string
suffix
string