当前位置: 首页>>代码示例>>C#>>正文


C# List.Count方法代码示例

本文整理汇总了C#中System.Windows.Documents.List.Count方法的典型用法代码示例。如果您正苦于以下问题:C# List.Count方法的具体用法?C# List.Count怎么用?C# List.Count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Documents.List的用法示例。


在下文中一共展示了List.Count方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: luhn_checksum

        public static bool luhn_checksum(List<int> card_number_array)
        {
            int checksum = 0;
            //adds up all the even placed digits
            for (int i = 0; i < card_number_array.Count(); i = i + 2)
            {
                checksum += card_number_array[i];
            }

            int index2 = 0;
            //now adds up (2 x odd placed digits)
            for (int i = 1; i < card_number_array.Count(); i = i + 2)
            {
                index2 = card_number_array[i] * 2;
                if (index2 >= 10)
                {
                    index2 = index2 - 9; // if 2 x digit > 10
                }
                checksum += index2;
            }

            if (checksum % 10 == 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
开发者ID:srscrls,项目名称:Luhn-algorithm,代码行数:30,代码来源:MainWindow.xaml.cs

示例2: CellsToArray

 private int[,] CellsToArray(List<List<Cell>> cells)
 {
     var result = new int[cells.Count(), cells.Max(cellsRow => cellsRow.Count())];
     for (int x = 0; x < cells.Count(); ++x)
     {
         for (int y = 0; y < cells[x].Count(); ++y)
         {
             result[x, y] = cells[x][y].Value;
         }
     }
     return result;
 }
开发者ID:DormantDreams,项目名称:video-game-level-scanner,代码行数:12,代码来源:PreviewImagesWindow.xaml.cs

示例3: Histogram

 public Histogram(List<double> vals, string name, double binSize = 0)
 {
     this.vals = vals;
     InitializeComponent();
     this.DataContext = this;
     //this.YAxis = new LinearAxis(AxisPosition.Left, name);
     if (binSize == 0) {
         binSize = Math.Round( 3.49 * vals.StandardDev() * Math.Pow(vals.Count(), -.33333), 3);
     }
     this.title = name;
     draw(binSize);
     this.NumberOfDataPoints = vals.Count();
 }
开发者ID:Amichai,项目名称:MySimulations,代码行数:13,代码来源:Histogram.xaml.cs

示例4: Results

        public Results(List<Items> result, String searchWord)
        {
            InitializeComponent();

            initResults = result;

            resultList = result;

            if(searchWord.Length == 0)
            {
                dialogMessage.Text = "You did not search for anything.\nPlease try again.";
                keywordLabel.Text = searchWord;
                resultSearch.Text = searchWord;
                resultList = null;
                return;
            }

            if(searchWord.Length != 0)
            {
                clearButton.Visibility = Visibility.Visible;
            }

            if (result.Count() > 10)
            {
                dialogMessage.Text = "Your search returned more than 10 results.\n\nYou may wish to make your search more specific to return less.";
                resultsListBox.ItemsSource = result;
                keywordLabel.Text = searchWord;
                resultSearch.Text = searchWord;
                sortLabel.Visibility = Visibility.Visible;
                sortOptions.Visibility = Visibility.Visible;
                locationLabel.Visibility = Visibility.Visible;
            }
            else if (result.Count() != 0)
            {
                resultsListBox.ItemsSource = result;
                keywordLabel.Text = searchWord;
                resultSearch.Text = searchWord;
                sortLabel.Visibility = Visibility.Visible;
                sortOptions.Visibility = Visibility.Visible;
                locationLabel.Visibility = Visibility.Visible;
            }
            else
            {
                dialogMessage.Text = "Your search returned 0 results.\n\nThe product you're looking for may:\n   - Not be sold here, or\n   - You may have made a spelling mistake.";
                keywordLabel.Text = searchWord;
                resultSearch.Text = searchWord;
            }
        }
开发者ID:edelaltares,项目名称:CPSC481,代码行数:48,代码来源:Results.xaml.cs

示例5: ChartLineUC

        public ChartLineUC(List<DataPointCollection> ListDataPoints, string[] zstr, string strtitle)
        {
            InitializeComponent();
            chartC.DataPointWidth = 2;
            Title title = new Title();
            title.Text = strtitle;
            chartC.Titles.Add(title);

            for (int i = 0; i < ListDataPoints.Count(); i++)
            {
                DataPointCollection dpc = ListDataPoints[i];
                chartC.Series[i].DataPoints = dpc;
                chartC.Series[i].LegendText = zstr[i];
                chartC.Series[i].ShowInLegend = true;
                chartC.Series[i].ToolTipText = string.Format("名称:#AxisXLabel {0}数值:#YValue {0}", System.Environment.NewLine);
                chartC.Series[i].AutoFitToPlotArea = true;
                chartC.Series[i].LabelEnabled = false;
                chartC.Series[i].Bevel = false;
                chartC.Series[i].ShadowEnabled = true;
                chartC.Series[i].YValueFormatString = "######.## ";
                chartC.Series[i].LightingEnabled = true;
                chartC.Series[i].LabelText = " #AxisXLabel";
                chartC.Series[i].LabelFontSize = 13;
                chartC.Series[i].IncludePercentageInLegend = true;
            }
        }
开发者ID:UEChip,项目名称:UENSimulation,代码行数:26,代码来源:ChartLineUC.xaml.cs

示例6: Button_Click_1

        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            List<ExportRowHelper> ExportColumnNames = new List<ExportRowHelper>();

            foreach (var item in ufgMain.Children)
            {
                CheckBox cb = item as CheckBox;
                if (cb.IsChecked.Value)
                {
                    ExportColumnNames.Add(new ExportRowHelper() { ColumnName = cb.Tag.ToString(), ColumnValue = cb.Content.ToString() });
                }
            }
            if (ExportColumnNames.Count() <= 0)
            {
                Common.MessageBox.Show("请选择需要导出的列");
                return;
            }
            SaveFileDialog sfd = new SaveFileDialog();
            sfd.FileName = string.Format("GlassID导出列表.xls");
            if (sfd.ShowDialog() == true)
            {
                string filename = sfd.FileName;
                string ErrMsg = string.Empty;
                bool bSucc = false;

                bSucc = _export.ExportGlassIDToExcel(_lst, ExportColumnNames, filename, ref ErrMsg);
                if (bSucc)
                {
                    var process = System.Diagnostics.Process.Start(filename);
                }
                else
                    Common.MessageBox.Show(ErrMsg);
            }
            this.Close();
        }
开发者ID:shew990,项目名称:github,代码行数:35,代码来源:ExportGlassIDs.xaml.cs

示例7: GetLayerList

        public static string[] GetLayerList(XElement xEle)
        {
            List<string> lst = new List<string>();
            XNamespace aw = xEle.GetDefaultNamespace();
            IEnumerable<XElement> de = from el in xEle.Descendants(aw + "Layer") select el;

            foreach (XElement el in de)
            {
                if (el.Elements(aw + "Name").Count() > 0)
                {
                    lst.Add(el.Elements(aw + "Name").First().Value);
                }
            }

            if (lst.Count() > 0)
            {
                string[] lyrList = new string[lst.Count];

                for (int i = 0; i < lst.Count; i++)
                {
                    lyrList[i] = lst[i];
                }
                return lyrList;
            }
            return null;
        }
开发者ID:k4th,项目名称:geoportal-server,代码行数:26,代码来源:LinqXmlHelper.cs

示例8: ScoreWindow

        public ScoreWindow(List<Game> games)
        {
            InitializeComponent();
            int cols = 4;
            int rows = games.Count();
            for (int c = 0; c < cols; c++)
                myTable.Columns.Add(new TableColumn());

            TableRow tr0 = new TableRow();
            tr0.Cells.Add(new TableCell(new Paragraph(new Run("Gra"))));
            tr0.Cells.Add(new TableCell(new Paragraph(new Run("Minimalny pomiar"))));
            tr0.Cells.Add(new TableCell(new Paragraph(new Run("Maksymalny pomiar"))));
            tr0.Cells.Add(new TableCell(new Paragraph(new Run("Odchylenie standardowe"))));
            TableRowGroup trg0 = new TableRowGroup();
            trg0.Rows.Add(tr0);
            myTable.RowGroups.Add(trg0);

            foreach (Game g in games)
            {
                if (g.getMaximum() == Double.MinValue)
                    continue;
               TableRow tr = new TableRow();
               tr.Cells.Add(new TableCell(new Paragraph(new Run(g.getName()))));
               tr.Cells.Add(new TableCell(new Paragraph(new Run(g.getMinimum().ToString("N3")))));
               tr.Cells.Add(new TableCell(new Paragraph(new Run(g.getMaximum().ToString("N3")))));
               tr.Cells.Add(new TableCell(new Paragraph(new Run(g.getDeviation().ToString("N3")))));

               TableRowGroup trg = new TableRowGroup();
               trg.Rows.Add(tr);
               myTable.RowGroups.Add(trg);
            }
        }
开发者ID:pianiel,项目名称:toik-kinect,代码行数:32,代码来源:ScoreWindow.xaml.cs

示例9: ZoomToShowAll

 private void ZoomToShowAll(List<LineModule> sampleTrackingModules)
 {
     int countTlane = sampleTrackingModules.Count(a => a is LaneT);
     mScale = 1;
     if(countTlane >= 7)
     {
         mScale = 6;
     }
     if (countTlane >= 8)
     {
         mScale = 0.8;
     }
     if (countTlane >= 10)
     {
         mScale = 0.7;
     }
     if (countTlane >= 12)
     {
         mScale = 0.6;
     }
     if (countTlane >= 14)
     {
         mScale = 0.5;
     }
     viewbox.LayoutTransform = new ScaleTransform(mScale, mScale);
 }
开发者ID:powerhai,项目名称:LayoutShowControl,代码行数:26,代码来源:MainWindow.xaml.cs

示例10: validado

        private Boolean validado(Object obj)
        {

            ValidationContext validationContext = new ValidationContext(obj, null, null);
            List<System.ComponentModel.DataAnnotations.ValidationResult> errors = new List<System.ComponentModel.DataAnnotations.ValidationResult>();
            Validator.TryValidateObject(obj, validationContext, errors, true);
           
            if (errors.Count() > 0)
            {
                
                string mensageErrores = string.Empty;
                foreach (var error in errors)
                {
                    error.MemberNames.First();
                   
                    mensageErrores += error.ErrorMessage + Environment.NewLine;
                }
                MessageBox.Show(mensageErrores); return false;
            }
            else
            {
                return true;


            }
           
        }
开发者ID:santii810,项目名称:Dam209,代码行数:27,代码来源:MainWindow.xaml.cs

示例11: foreach

        // Напечатаем окно заказа:
        private void НапечататьЗаказы(object sender, RoutedEventArgs e)
        {
            // Очистим окно и заново добавим,указав для каждого продукта:сколько его заказали
            if (СписокЗаказов.Count>0)
            {
                var новыеЗаказы = new List<Заказ>();

                foreach (var заказ in СписокЗаказов)
                {
                    if (новыеЗаказы.Count(x => x == заказ) == 0)
                        новыеЗаказы.Add(заказ);
                }

                ОкноВывода.Items.Clear();
                int sum = 0;
                foreach (var заказ in новыеЗаказы)
                {
                    var количетсво = СписокЗаказов.Count(x => x == заказ);
                    sum += заказ.цена * количетсво;
                    ОкноВывода.Items.Add(" " + заказ.продукт + "(" + заказ.цена + "р.): " + количетсво + "штук(и) = " + заказ.цена * количетсво);
                }
                ОкноВывода.Items.Add("Сумма: " + sum + "р.");
            }
            else
            {
                    ОкноВывода.Items.Add("Заказов нет!");
            }
        }
开发者ID:GarageInc,项目名称:all,代码行数:29,代码来源:MainWindow.xaml.cs

示例12: foreach

        // Напечатаем окно заказа:
        private void Итого_Click(object sender, RoutedEventArgs e)
        {
            // Очистим окно и заново добавим,указав для каждого продукта:сколько его заказали
            if (Заказы.Count>0)
            {
                var новыеЗаказы = new List<ПродуктЦена>();

                foreach (var заказ in Заказы)
                {
                    if (новыеЗаказы.Count(x => x == заказ) == 0)
                        новыеЗаказы.Add(заказ);
                }

                ОкноВывода.Items.Clear();
                int sum = 0;
                foreach (var заказ in новыеЗаказы)
                {
                    var количетсво = Заказы.Count(x => x == заказ);
                    sum += заказ.цена * количетсво;
                    ОкноВывода.Items.Add("-> " + заказ.product + "(" + заказ.цена + "р.): " + количетсво + "штук(и) = " + заказ.цена * количетсво);
                }
                ОкноВывода.Items.Add("Сумма к оплате: " + sum + "р.");
            }
            else
            {
                    ОкноВывода.Items.Add("Заказы отсутствуют");
            }
        }
开发者ID:GarageInc,项目名称:all,代码行数:29,代码来源:MainWindow.xaml.cs

示例13: BubbleCurrentSelection

 private void BubbleCurrentSelection(object _nothing) 
 {
     var slide = Globals.slide;
     var currentDetails = Globals.conversationDetails;
     string target = null;
     var selection = new List<SelectedIdentity>();
     foreach(var registeredCommand in Commands.DoWithCurrentSelection.RegisteredCommands)
         registeredCommand.Execute((Action<SelectedIdentity>)(id=>{
             target = id.target;
             selection.Add(id);
         }));
     if (selection.Count() > 0)
     {
         var details = ConversationDetailsProviderFactory.Provider.AppendSlideAfter(Globals.slide, currentDetails.Jid, Slide.TYPE.THOUGHT);
         var newSlide = details.Slides.Select(s => s.id).Max();
         Commands.SendNewBubble.Execute(new TargettedBubbleContext
                                            {
                                                author = Globals.me,
                                                context = selection,
                                                privacy = "public",
                                                slide = slide,
                                                target = target,
                                                thoughtSlide =newSlide 
                                            });
     }
 } 
开发者ID:StackableRegiments,项目名称:metl2011,代码行数:26,代码来源:ThoughtBubbleLauncher.xaml.cs

示例14: buttonSave_Click

        private void buttonSave_Click(object sender, RoutedEventArgs e)
        {
            List<Figuur> GewijzigdeFiguren = new List<Figuur>();
            foreach (Figuur f in figuren)
            {
                if (f.Changed == true)
                    GewijzigdeFiguren.Add(f);
                f.Changed = false;
            }
            if(GewijzigdeFiguren.Count() != 0)
            {
                FiguurManager manager = new FiguurManager();
                try
                {
                    manager.SChrijfWijzigingen(GewijzigdeFiguren);
                }
                catch (Exception ex)
                {

                   MessageBox.Show(ex.Message);
                }

            }
            GewijzigdeFiguren.Clear();
        }
开发者ID:kurtkreemers,项目名称:AdoCursus,代码行数:25,代码来源:StripFiguren.xaml.cs

示例15: allButton_Click

 private void allButton_Click(object sender, RoutedEventArgs e)
 {
     List<ManagePlaylist.File> tmp = new List<ManagePlaylist.File>();
     filterAll(tmp);
     playListBox.Items.Clear();
     for (int i = 0; i < tmp.Count(); ++i)
     {
         playListBox.Items.Add(getName(tmp[i].Path));
     }
 }
开发者ID:alekece,项目名称:school-projects,代码行数:10,代码来源:MainWindow.xaml.cs


注:本文中的System.Windows.Documents.List.Count方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。