コード例 #1
0
        public MoveStaticMembersDialogViewModel(
            StaticMemberSelectionViewModel memberSelectionViewModel,
            string defaultType,
            ImmutableArray <TypeNameItem> availableTypes,
            string prependedNamespace,
            ISyntaxFacts syntaxFacts)
        {
            MemberSelectionViewModel = memberSelectionViewModel;
            _syntaxFacts             = syntaxFacts ?? throw new ArgumentNullException(nameof(syntaxFacts));
            _searchText        = defaultType;
            _destinationName   = new TypeNameItem(defaultType);
            AvailableTypes     = availableTypes;
            PrependedNamespace = string.IsNullOrEmpty(prependedNamespace) ? prependedNamespace : prependedNamespace + ".";

            PropertyChanged += MoveMembersToTypeDialogViewModel_PropertyChanged;
            OnDestinationUpdated();
        }
コード例 #2
0
ファイル: TypeNameItem.cs プロジェクト: lameox/roslyn
        public static int CompareTo(TypeNameItem x, TypeNameItem y)
        {
            // sort so that history is first, then type name, then file name
            if (x.IsFromHistory ^ y.IsFromHistory)
            {
                // one is from history and the other isn't
                return(x.IsFromHistory ? -1 : 1);
            }
            // compare by each namespace/finally type
            var xnames = x.TypeName.Split('.');
            var ynames = y.TypeName.Split('.');

            for (var i = 0; i < Math.Min(xnames.Length, ynames.Length); i++)
            {
                var comp = xnames[i].CompareTo(ynames[i]);
                if (comp != 0)
                {
                    return(comp);
                }
            }

            return(x.DeclarationFileName.CompareTo(y.DeclarationFileName));
        }