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();
        }
    }
}

运行结果

相关推荐
m5655bj1 小时前
通过 C# 将 RTF 文档转换为图片
开发语言·c#
MM_MS2 小时前
WinForm+C#小案例--->写一个记事本程序
开发语言·计算机视觉·c#·visual studio
浪客川4 小时前
高效日志分离器:一键筛选关键信息
开发语言·windows·c#
小熊熊知识库5 小时前
C# EF.core 介绍以及高性能使用
开发语言·c#
雨疏风骤12405 小时前
【FreeRTOS】任务、任务状态
开发语言·stm32·c#·rtos
️公子7 小时前
传奇游戏集成系统
游戏·c#
玩泥巴的7 小时前
强的飞起的 Roslyn 编译时代码生成,实现抽象类继承与依赖注入的自动化配置
c#·.net·代码生成·roslyn
mudtools7 小时前
强的飞起的 Roslyn 编译时代码生成,实现抽象类继承与依赖注入的自动化配置
c#·.net
️公子8 小时前
无人直播系统-黑客主题
人工智能·c#·visual studio
c#上位机10 小时前
halcon图像去噪—中值滤波
图像处理·c#·halcon