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


C# Int32.Select方法代码示例

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


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

示例1: GetPageSizes

 internal static IEnumerable<SelectListItem> GetPageSizes(Int32[] pageSizes = null, Int32? currentSize = null)
 {
     if (pageSizes == null)
         pageSizes = TableModel.DefaultPageSizes;
     if (currentSize.HasValue && !pageSizes.Contains(currentSize.Value))
         pageSizes = pageSizes.Union(new[] { currentSize.Value }).OrderBy(p => p).ToArray();
     return pageSizes.Select(i => new SelectListItem { Text = i.ToString(), Value = i.ToString(), Selected = i == TableModel.DefaultPageSize });
 }
开发者ID:artiomchi,项目名称:FlexLabs.Util.Web,代码行数:8,代码来源:TableModel.cs

示例2: TargetProjectionsOfElementsAreReturnedWhenSourceIsEmpty

            public void TargetProjectionsOfElementsAreReturnedWhenSourceIsEmpty()
            {
                var source = new Int32[0];
                var expected = new Boolean[0];
                var result = source.Select(i => i == 0);

                Assert.That(result, Is.EqualTo(expected));
            }
开发者ID:kawillia,项目名称:LinqToObjects,代码行数:8,代码来源:SelectTests.cs

示例3: LogarithmicCorrection

 /// <summary>
 /// g = c * log (1 + f)
 /// </summary>
 /// <param name="pixels"></param>
 /// <param name="c">constant</param>
 /// <returns></returns>
 public static Int32[] LogarithmicCorrection(Int32[] pixels, byte c)
 {
     return pixels.Select(pixel => Pixel.SetBrightness(pixel, Pixel.GetValidByte(c * Math.Log(1 + Pixel.GetBrightness(pixel))))).ToArray();
 }
开发者ID:aliaksandr-khlebus-epam,项目名称:ImageProcessing,代码行数:10,代码来源:BmpEditor.cs

示例4: ChangeBrightness

 /// <summary>
 /// g = c + f
 /// </summary>
 /// <param name="pixels"></param>
 /// <param name="c">constant</param>
 /// <returns></returns>
 public static Int32[] ChangeBrightness(Int32[] pixels, byte c)
 {
     return pixels.Select(pixel => Pixel.SetBrightness(pixel, Pixel.GetValidByte(c + Pixel.GetBrightness(pixel)))).ToArray();
 }
开发者ID:aliaksandr-khlebus-epam,项目名称:ImageProcessing,代码行数:10,代码来源:BmpEditor.cs

示例5: SetIndices

 public void SetIndices(MLOD mlod, MLOD.Mesh mesh, MLOD.GeometryState geometryState, Int32[] indices)
 {
     SetIndices(mlod, mesh.IndexBufferIndex, mesh.PrimitiveType, geometryState.StartIndex, geometryState.PrimitiveCount,
         indices.Select(x => x + geometryState.MinVertexIndex).ToArray());
     geometryState.PrimitiveCount = indices.Length / IndexCountFromPrimitiveType(mesh.PrimitiveType);
 }
开发者ID:falerin,项目名称:Sims4Tools,代码行数:6,代码来源:IBUF.cs

示例6: GetDataBySite

 public List<TaskDetail> GetDataBySite(Int64 TaskHeaderID, String TaskSite, Int32[] TaskStatus)
 {
     String Query = "SELECT * FROM TaskDetail WHERE TaskHeaderID = @TaskHeaderID AND TaskSite = @TaskSite AND TaskStatus IN ({0})";
     Query = String.Format(Query, String.Join(",", TaskStatus.Select(x => x.ToString()).ToArray()));
     SqlCeDataManager oDm = new SqlCeDataManager(ConnectionString, Query, true);
     oDm.AddIntegerBigPara("TaskHeaderID", TaskHeaderID);
     oDm.AddVarcharPara("TaskSite", 4000, TaskSite);
     return DataParser.ToList<TaskDetail>(oDm.GetTable());
 }
开发者ID:riskypathak,项目名称:WebSpider,代码行数:9,代码来源:TaskDetailManager.cs

示例7: GetDataByStatus

 public List<TaskDetail> GetDataByStatus(Int64 TaskHeaderID, Int32[] TaskStatus)
 {
     String Query = "SELECT * FROM TaskDetail WHERE TaskHeaderID = " + TaskHeaderID.ToString()
         + " AND TaskStatus IN (" + string.Join(",", TaskStatus.Select(x => x.ToString())) + ")";
     SqlCeDataManager oDm = new SqlCeDataManager(ConnectionString, Query, true);
     return DataParser.ToList<TaskDetail>(oDm.GetTable());
 }
开发者ID:riskypathak,项目名称:WebSpider,代码行数:7,代码来源:TaskDetailManager.cs

示例8: save_button_Click

        private void save_button_Click(object sender, EventArgs e)
        {
            Int32[] new_ingredients;
            new_ingredients = new Int32[10];

            // get information about the selected ingredient and calibration for each pump
            var combo_boxes = settingsPanel.Controls
                           .OfType<ComboBox>()
                           .Where(txt => txt.Name.ToLower().StartsWith("seting"));

            int pump = 0;
            foreach (ComboBox txt in combo_boxes)
            {
                new_ingredients[pump] = txt.SelectedIndex;
                pump++;
            }

            var calib_textboxes = settingsPanel.Controls
                           .OfType<TextBox>()
                           .Where(txt => txt.Name.ToLower().StartsWith("calib"));

            pump = 0;
            Int16[] calib_value;
            calib_value = new Int16[10];
            foreach (TextBox txt in calib_textboxes)
            {
                calib_value[pump] = Convert.ToInt16(txt.Text);
                pump++;
            }

            // start assuming we don't have a duplicate
            bool duplicate = false;

            for (int i = 0; i < 10; i++)
            {
                for (int j = i + 1; j < 10; j++)
                {
                    if ((new_ingredients[i] == new_ingredients[j]) && (new_ingredients[i] != 0))
                        // verify all the ingredients for duplicates
                        duplicate = true;
                }

            }

            // give error if duplicates
            if (!duplicate)
            {
                try
                {
                    System.IO.File.WriteAllLines(@"available_ing.txt", new_ingredients.Select(x => x.ToString()).ToArray());
                    System.IO.File.AppendAllLines(@"available_ing.txt", calib_value.Select(x => x.ToString()).ToArray());
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                // Reload
                LoadAll(this, EventArgs.Empty);
                // close seetings panel
                settingsPanel.Visible = false;
            }
            else
            {
                MessageBox.Show("Duplicates were found. \nPlease make sure that you don't have the same ingredient in two slots");
            }
        }
开发者ID:kyotox,项目名称:Cocktailer,代码行数:66,代码来源:Cocktailer+Form.cs

示例9: GetQuantizedImage

        //Input image and returns a color quantized image (Hardcoded to 31 color - HSB Algorithm!)
        //31 color to allow for a transparent BG color
        private Image GetQuantizedImage(Image image)
        {
            // checks whether a source image is valid
            if (image == null)
            {
                const String message = "Cannot quantize a null image.";
                throw new ArgumentNullException(message);
            }

            // locks the source image data
            Bitmap bitmap = (Bitmap)image;
            Rectangle bounds = Rectangle.FromLTRB(0, 0, bitmap.Width, bitmap.Height);
            BitmapData sourceData = bitmap.LockBits(bounds, ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);

            // prepares time statistics variables
            TimeSpan duration = new TimeSpan(0);
            DateTime before;

            try
            {
                // initalizes the pixel read buffer
                Int32[] sourceBuffer = new Int32[image.Width];

                // sets the offset to the first pixel in the image
                Int64 sourceOffset = sourceData.Scan0.ToInt64();

                for (Int32 row = 0; row < image.Height; row++)
                {
                    // copies the whole row of pixels to the buffer
                    Marshal.Copy(new IntPtr(sourceOffset), sourceBuffer, 0, image.Width);

                    // scans all the colors in the buffer
                    foreach (Color color in sourceBuffer.Select(argb => Color.FromArgb(argb)))
                    {
                        before = DateTime.Now;

                        //Ideas to do the transparent color:
                        // make a mask
                        // AND the bytes
                        if(color != System.Drawing.Color.FromArgb(255,255,0,255))
                              //   .the_quantizerthe_quantizer.AddColor(color);

                        duration += DateTime.Now - before;
                    }

                    // increases a source offset by a row
                    sourceOffset += sourceData.Stride;
                }

                // editTargetInfo.Text = string.Format("Quantized: {0} colors (duration {1})", 256, duration); // TODO
            }
            catch
            {
                bitmap.UnlockBits(sourceData);
                throw;
            }

            Bitmap result = new Bitmap(image.Width, image.Height, PixelFormat.Format8bppIndexed);

            // calculates the palette
            try
            {
                before = DateTime.Now;
                Int32 colorCount = 31; //GetColorCount();
             //   List<Color> palette = the_quantizer.GetPalette(colorCount);

                // sets our newly calculated palette to the target image
                ColorPalette imagePalette = result.Palette;
                duration += DateTime.Now - before;

                imagePalette.Entries[0] = System.Drawing.Color.FromArgb(255, 255, 0, 255);

            /*    for (Int32 index = 1; index-1 < palette.Count; index++)
                {
                   imagePalette.Entries[index] = palette[index-1];
                }
                */
                result.Palette = imagePalette;

            }
            catch (Exception)
            {
                bitmap.UnlockBits(sourceData);
                throw;
            }

            // locks the target image data
            BitmapData targetData = result.LockBits(bounds, ImageLockMode.WriteOnly, PixelFormat.Format8bppIndexed);

            try
            {
                // initializes read/write buffers
                Byte[] targetBuffer = new Byte[result.Width];
                Int32[] sourceBuffer = new Int32[image.Width];

                // sets the offsets on the beginning of both source and target image
                Int64 sourceOffset = sourceData.Scan0.ToInt64();
                Int64 targetOffset = targetData.Scan0.ToInt64();
//.........这里部分代码省略.........
开发者ID:dext3r,项目名称:NBA-JAM-Player-Editor,代码行数:101,代码来源:nbajamPictureBox.cs


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