Code :

public static string GetLoggingString(this object obj)
{
using (var stream = new MemoryStream())
{
new XmlSerializer(obj.GetType()).Serialize(stream, obj);
stream.Position = ;
var buffer = new byte[stream.Length];
stream.ReadAsync(buffer, , buffer.Length);
stream.FlushAsync();
return Encoding.UTF8.GetString(buffer);
}
}

usage :

var list = new List<string> { "abs", "sdf", "srer" };
var d = list.GetLoggingString();

result :

<?xml version="1.0"?>
<ArrayOfString xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<string>abs</string>
<string>sdf</string>
<string>srer</string>
</ArrayOfString>

Gets the... Of any serializable object Xml character string , It is convenient to view any interested object in the log . More articles about

  1. The serialized object is xml character string

    /// <summary>    /// The serialized object is xml character string     /// </summary>    /// <param name="obj" ...

  2. JS object JavaScript Everything in is an object , Such as : character string 、 The number 、 Array 、 Functions, etc , Each object has properties and methods .

    What is an object JavaScript Everything in is an object , Such as : character string . The number . Array . Functions, etc , Each object has properties and methods . Object properties : Reflecting certain properties of the object , Such as : Length of string . Length and width of image : Object method : ...

  3. About gc In the log Desired Survivor The question and the summary of the old age

    The problem background ( All of the following is based on the book Serial/Serial Old In this case ) stay < In depth understanding of JVM> In a book ——3.6.3 The long-term survivors will be introduced into the old age , An example of jvm ...

  4. 41-ssm The object in is found correctly, but a member variable that does not assign an attribute value to the object in the database

    reason : Although the variable name is related to Database fields are consistent , however Include underscores , Such as : a_b, Databases are also a_b: however ssm Open the hump and name it , Change the variable name to    aB , Just name the hump .

  5. .NET analysis xml character string , Assign values to entity class objects by reflection , Get entity class data list

    /// <summary> /// analysis xml character string Convert to entity class list data /// </summary> /// <param name="xmlStr&quo ...

  6. xml turn Map, object ,Map turn xml,inputs tram turn xml String tool class method

    as everyone knows , In the wechat development project , Because the wechat development document , For the receiving and sending of messages, they are the basis xml Data ( It's too much ), So we need to deal with XML Make analytic transformation : 1. Let's first introduce the required dependencies dom4j ( analysis xml Of ),xs ...

  7. javascript Object serialization ( Object and the JSON The interchange of strings )

    It was used some time ago h5 Local storage of --- You need to put some js Objects are stored in the browser's local storage , Yes javascript Object serialization and deserialization Serialization is the process of transforming the state information of an object into a form that can be stored or transmitted , Basically ...

  8. XML String and JAVA Conversion between objects

     1.JAXB Related notes in . Class and interface description JAXB  Some of the main notes in  - shenyunsese  The column  - CSDN  Blog notes : The course is very comprehensive and detailed . But for reference only . Distinguish and explain the main questions :  1.1 @X ...

  9. generic class Objects and XML Interturn

    public class XMLHealper { /// <summary> /// Serializes a custom object to XML character string /// </summary> /// <para ...

Random recommendation

  1. YII2 Load default values loadDefaultValues

    I'm lazy , So I like to find something ready to use , So when loading the default value, I directly chose Yii2 Self contained loadDefaultValues The problem is coming. , When I submitted it, I found that I was rules It's set inside default jobless [ ...

  2. Python Study day 20 django knowledge

    One ,django models 1,django ORM How to get background data , There are three kinds of (1)v1 = models.Business.objects.all()   The return value is QuerySet type , Inside ...

  3. QProcess How to read in real time output Information about

    stay Qt I want to communicate with subroutines , Generally used QProcess This class , And the manual also mentioned a lot of communication methods , Like in the manual "Communicating via Channels". I don't like it either ...

  4. Transfer the data file from asm Move to the normal file system

    A scenario where the database can be shut down : 1. Close and re mount database $ sqlplus '/as sysdba' SQL> shutdown immediate; SQL> startup mount ...

  5. tomcat Next bin Under the folder shell File analysis

    stay bin There is 9 individual sh file , This article will analyze step by step , Today is the day version.sh For example os400=false #uname Take the name of the operating system Such as Linux If OS400 Operating system of Special treatment case &quo ...

  6. Use git ftp Post my personal hexo Blog content

    Blogs in your own virtual host are created by hexo3 + next The theme , Because I want to hexo The compiled files can be generated through ftp The order was issued to ftp On the server . The tools used for publishing are git-ftp: according to Use Jenkins an ...

  7. Implement bit exchange protocol according to my own understanding (alternating-bit protocol)

    At the beginning, I wanted to write two programs , Sender and receiver . But then I thought about , Because it's simulated , So don't bother , Customize the scene directly ( For example, packet loss , There is something wrong with the package , Overtime or something ). It's basically based on the picture above , A function , A function followed by ...

  8. ALAssetsLibrary Learning summary

    add to AssetsLibrary.framework Then introduce the #import <AssetsLibrary/ALAssetsLibrary.h> A class to get all the pictures #import &l ...

  9. MongoDB:The Definitive Guide CHAPTER 2 Getting Started

    MongoDB is very powerful, but it is still easy to get started with. In this chapter we’ll introduce ...

  10. RPC distributed processing

    RPC( Remote procedure call ) Application Contact the background Because of the need of a project at work, a distributed processing time-consuming operation is designed , Each node then returns the result to the central server , I didn't understand at first RPC Before this part, my design was in every RPC Set up one on the server ...