Пример #1
0
        }         // end sub

        /// <summary>
        /// <para xml:lang="en">Dump properties of a object to a TSV file. Output single objects on one row of the TSV file.</para>
        /// <para xml:lang="ja">オブジェクトのプロパティをTSVファイルにダンプします。1のオブジェクトをTSVファイルの1行に出力します。</para>
        /// </summary>
        /// <typeparam name="T">
        /// <para xml:lang="en">The type of object to dump.</para>
        /// <para xml:lang="ja">ダンプするオブジェクトの型</para>
        /// </typeparam>
        /// <param name="target">
        /// <para xml:lang="en">The object to dump.</para>
        /// <para xml:lang="ja">ダンプするオブジェクト</para>
        /// </param>
        /// <param name="name">
        /// <para xml:lang="en">The name which is used for a file.</para>
        /// <para xml:lang="ja">ファイルに使用される名前。</para>
        /// </param>
        /// <param name="format">
        /// <para xml:lang="en">
        /// The lambda expression which is used for choosing properties to dump.
        /// Set like <code>a=&gt;new {a.A, a.B}</code>  to dump A property and B property of the object.
        /// Set like <code>a=&gt;a</code>  to dump all properties of the object.
        /// </para>
        /// <para xml:lang="ja">
        /// ダンプするプロパティを選択するラムダ式。
        /// オブジェクトのAプロパティとBプロパティをダンプする場合には、<code>a=&gt;new {a.A, a.B}</code> のように指定します。
        /// 全てのプロパティをダンプする場合には<code>a=&gt;a</code>を指定します。
        /// </para>
        /// </param>
        /// <param name="writeHeader">
        /// <para xml:lang="en">
        /// Set true to output a header of a TSV file. The names of properties of the object are output.
        /// Set false and so a header is not outputted. Use the DumpTsvHeader method or the WriteTsvHeader method to output the header, separately.
        /// </para>
        /// <para xml:lang="ja">
        /// TSVファイルの1行目にヘッダを出力する場合はtrueを指定します。オブジェクトのプロパティ名が出力されます。
        /// falseを指定するとヘッダが出力されません。別途、DumpTsvHeaderメソッドやWriteTsvHeaderメソッドを使用してヘッダを出力してください。
        /// </para>
        /// </param>
        public static void DumpTsvRecord <T>(T target, string name, Func <T, object> format, bool writeHeader = false)
        {
            Dumper.DumpTsv(new T[] { target }, name, format, writeHeader);
        } // end sub
Пример #2
0
 /// <summary>
 /// <para xml:lang="en">Dump properties of a object to a TSV file. Output multiple objects on each rows of the TSV file.</para>
 /// <para xml:lang="ja">オブジェクトのプロパティをTSVファイルにダンプします。複数のオブジェクトをTSVファイルの各行に出力します。</para>
 /// </summary>
 /// <typeparam name="T">
 /// <para xml:lang="en">The type of object to dump.</para>
 /// <para xml:lang="ja">ダンプするオブジェクトの型</para>
 /// </typeparam>
 /// <param name="me">
 /// <para xml:lang="en">The collection of objects to dump.</para>
 /// <para xml:lang="ja">ダンプするオブジェクトのコレクション</para>
 /// </param>
 /// <param name="name">
 /// <para xml:lang="en">The name which is used for a file.</para>
 /// <para xml:lang="ja">ファイルに使用される名前。</para>
 /// </param>
 /// <param name="format">
 /// <para xml:lang="en">
 /// The lambda expression which is used for choosing properties to dump.
 /// Set like <code>a=&gt;new {a.A, a.B}</code>  to dump A property and B property of the object.
 /// Set null or like <code>a=&gt;a</code>  to dump all properties of the object.
 /// </para>
 /// <para xml:lang="ja">
 /// ダンプするプロパティを選択するラムダ式。
 /// オブジェクトのAプロパティとBプロパティをダンプする場合には、<code>a=&gt;new {a.A, a.B}</code> のように指定します。
 /// 全てのプロパティをダンプする場合にはnull、あるいは<code>a=&gt;a</code>を指定します。
 /// </para>
 /// </param>
 /// <param name="writeHeader">
 /// <para xml:lang="en">
 /// Set true to output a header of a TSV file. The names of properties of the object are output.
 /// Set false and so a header is not outputted. Use the DumpTsvHeader method or the WriteTsvHeader method to output the header, separately.
 /// </para>
 /// <para xml:lang="ja">
 /// TSVファイルの1行目にヘッダを出力する場合はtrueを指定します。オブジェクトのプロパティ名が出力されます。
 /// falseを指定するとヘッダが出力されません。別途、DumpTsvHeaderメソッドやWriteTsvHeaderメソッドを使用してヘッダを出力してください。
 /// </para>
 /// </param>
 public static void DumpTsv <T>(this IEnumerable <T> me, string name, Func <T, object> format = null, bool writeHeader = true)
 {
     Dumper.DumpTsv(me, name, format ?? (a => a), writeHeader);
 }