mk.helpers
Search Results for

    Show / Hide Table of Contents

    Class CsvHelper

    Provides methods for converting data to CSV format.

    Inheritance
    object
    CsvHelper
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: mk.helpers
    Assembly: mk.helpers.dll
    Syntax
    public static class CsvHelper

    Methods

    ToCsv<T>(IEnumerable<T>)

    Converts a collection of items to a CSV string.

    Declaration
    public static string ToCsv<T>(this IEnumerable<T> items) where T : class
    Parameters
    Type Name Description
    IEnumerable<T> items

    The collection of items.

    Returns
    Type Description
    string

    The CSV string.

    Type Parameters
    Name Description
    T

    The type of items in the collection.

    ToCsv<T>(IEnumerable<T>, bool, char)

    Converts a collection of items to a CSV string with optional header.

    Declaration
    public static string ToCsv<T>(this IEnumerable<T> items, bool addHeader = false, char delimiter = ',') where T : class
    Parameters
    Type Name Description
    IEnumerable<T> items

    The collection of items.

    bool addHeader

    Whether to add a header row.

    char delimiter

    The delimiter character.

    Returns
    Type Description
    string

    The CSV string.

    Type Parameters
    Name Description
    T

    The type of items in the collection.

    ToCsv<T>(IEnumerable<T>, char)

    Converts a collection of items to a CSV string with a specified delimiter.

    Declaration
    public static string ToCsv<T>(this IEnumerable<T> items, char delimiter = ',') where T : class
    Parameters
    Type Name Description
    IEnumerable<T> items

    The collection of items.

    char delimiter

    The delimiter character.

    Returns
    Type Description
    string

    The CSV string.

    Type Parameters
    Name Description
    T

    The type of items in the collection.

    ToCsv<T>(List<T>)

    Converts a list of items to a CSV string.

    Declaration
    public static string ToCsv<T>(this List<T> items) where T : class
    Parameters
    Type Name Description
    List<T> items

    The list of items.

    Returns
    Type Description
    string

    The CSV string.

    Type Parameters
    Name Description
    T

    The type of items in the list.

    ToCsv<T>(List<T>, char)

    Converts a list of items to a CSV string with a specified delimiter.

    Declaration
    public static string ToCsv<T>(this List<T> items, char delimiter = ',') where T : class
    Parameters
    Type Name Description
    List<T> items

    The list of items.

    char delimiter

    The delimiter character.

    Returns
    Type Description
    string

    The CSV string.

    Type Parameters
    Name Description
    T

    The type of items in the list.

    ToCsv<T>(T, bool, char)

    Converts an item to its CSV representation.

    Declaration
    public static string ToCsv<T>(T item, bool addHeader = false, char delimiter = ',') where T : class
    Parameters
    Type Name Description
    T item

    The item to convert.

    bool addHeader

    Whether to add a header row.

    char delimiter

    The delimiter character.

    Returns
    Type Description
    string

    The CSV representation of the item.

    Type Parameters
    Name Description
    T

    The type of the item.

    ToCsv<T>(T[], bool, char)

    Converts an array of items to a CSV string with optional header.

    Declaration
    public static string ToCsv<T>(this T[] items, bool addHeader = false, char delimiter = ',') where T : class
    Parameters
    Type Name Description
    T[] items

    The array of items.

    bool addHeader

    Whether to add a header row.

    char delimiter

    The delimiter character.

    Returns
    Type Description
    string

    The CSV string.

    Type Parameters
    Name Description
    T

    The type of items in the array.

    In this article
    Back to top mk.helpers - MIT License