public string CreateUniqueName(string nameFolder) { var i = 2; var strName = nameFolder; while (ChildsCollection.Any(o => o.Name == strName)) { strName = $"{nameFolder} ({i++})"; } return(strName); }
public void AddFolder(object name) { var uniqueName = CreateUniqueName(_mainViewModel.StartNameFolder); ChildsCollection?.Add(new FolderTree(this, uniqueName, _mainViewModel)); }