2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

C#でIEnumerableを実装からのファイルを列挙してデータソースを作る(不足などがあれば指摘お願いします)

Last updated at Posted at 2016-11-20
using System;
using System.Collections.Generic;
using System.Linq;

namespace Question1
{
    class Program
    {
        static void Main(string[] args)
        {//IEnumerableを実装する
            int[] scores = new int[] { 0,-1, -2 };
            IEnumerable<int> scoreQuery =//変数の値の範囲を指定
                    from score in scores
                    where score > -2
                    select score;

            foreach (int checkpoint in scoreQuery)
            {//scoreQueryを列挙
                Console.WriteLine("checkpoint" + checkpoint);//変数と文字列の連結表示処理
                
            }
                Console.ReadKey();
        }
        public class hogehoge : Program//継承させてProgramクラスの動作を再利用
        {
            static void Sub()
            {
                Console.WriteLine("hogehoge");
                Console.ReadKey();
            }
        }
    }
}
2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?