示例#1
0
        /// <summary>
        /// 祝日の読み込み
        /// </summary>
        /// <param name="filePath"></param>
        /// <returns></returns>
        List<Holiday> LoadHoliday( string filePath )
        {
            var	holidays	= new List<Holiday>();

            using( var parser = new TextFieldParser( filePath, Encoding.UTF8 ) )
            {
                parser.TextFieldType	= FieldType.Delimited;
                parser.SetDelimiters( "," );

                // ヘッダー
            //				var	header	= parser.ReadFields();

                while( parser.EndOfData == false )
                {
                    var	rows	= parser.ReadFields();

                    DateTime	date;
                    if( DateTime.TryParse( rows[0], out date ) )
                    {
                        var	holiday	= new Holiday( date, rows[1] );
                        holidays.Add( holiday );
                    }
                }
            }

            return	holidays;
        }