C# 循环

C#循环

代码

csharp 复制代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Test
    {
        static void Main(string[] args)
        {
            int a = 5;
            int[] b = { 1, 2, 3, 4, 5, 6, 7, 8 };
            int c = 0;
            for (int i = 0; i < a; i++)
            {
                Console.WriteLine("i:" + i);
            }
            foreach (var item in b)
            {
                Console.WriteLine("b[" + c++ +"]:" + item);
            }
            Console.ReadLine();
        }
    }
}

运行结果

相关推荐
暮疯不疯6 小时前
C#常见术语表格
开发语言·c#
JQLvopkk7 小时前
VS2015使用C#连接KepserverEX并操作读写节点
开发语言·c#
流水线上的指令侠9 小时前
补充说明——针对《C#:从 0 到 1 创建基于 NUnit + FlaUI 的 WPF UI 自动化测试项目》
功能测试·ui·c#·自动化·wpf
流水线上的指令侠10 小时前
C# 实战:从 0 到 1 搭建基于 NUnit + FlaUI 的 WPF UI 自动化测试项目
功能测试·ui·c#·自动化·wpf·visual studio
gc_229911 小时前
学习C#调用OpenXml操作word文档的基本用法(20:学习嵌入文件类)
c#·word·openxml·嵌入文档
玩泥巴的11 小时前
如何实现一套.net系统集成多个飞书应用
c#·.net·二次开发·飞书
ghie909011 小时前
基于C#实现俄罗斯方块游戏
开发语言·游戏·c#
ccut 第一混11 小时前
C# 基于 RS485 与设备通讯(以照度计为例子)
c#·rs485
贾修行12 小时前
.NET 全栈开发学习路线:从入门到分布式
c#·.net·wpf·asp.net core·web api·winforms·services