working on it ...


Explore Public Snippets

Sort by

Found 1 snippet matching: nopcommercestore

    public by bojan.hrnkas  225158  0  7  0

    Serializing a C# object to XML

    We use a simplified object WSCustomer, since we only want some members of Customer to get serialized.
    public string GetCustomerData(int customers_Id)
        Customer customers = IoC.Resolve<ICustomerService>().GetCustomerById(customers_Id);
        WSCustomer wsCustomer = WSMapping(customers);
        StringBuilder sb = new StringBuilder();
        using (TextWriter tw = new StringWriter(sb))
            XmlSerializer xmlS = new XmlSerializer(typeof(WSCustomer));
            xmlS.Serialize(tw, wsCustomer);
            string serialized = sb.ToString();
            return serialized;

    List Complete ( 1 snippet total )

    Cannot find what you were looking for?
    Ask the Snip2Code Community

    • Public Snippets
    • Channels Snippets