「C#」配列の要素を取得するサンプル

2021年3月1日

サンプル

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
using System;
namespace MyApplication
{
class Program
{
static void Main(string[] args)
{
string[] cft = {"A001", "B002", "C003", "D004"};
for (int i = 0; i < cft.Length; i++)
{
Console.WriteLine(cft[i]);
}
}
}
}
using System; namespace MyApplication { class Program { static void Main(string[] args) { string[] cft = {"A001", "B002", "C003", "D004"}; for (int i = 0; i < cft.Length; i++) { Console.WriteLine(cft[i]); } } } }
using System;

namespace MyApplication
{
  class Program
  {
    static void Main(string[] args)
    {
      string[] cft = {"A001", "B002", "C003", "D004"};
      for (int i = 0; i < cft.Length; i++) 
      {
        Console.WriteLine(cft[i]);
      }
    }
  }
}

実行結果
A001
B002
C003
D004

C#

Posted by arkgame