# Region Print all attributes of an object
/// <Summary>
/// Print all attributes of an object
/// </Summary>
/// <Param name = "OBJ"> </param>
/// <Returns> </returns>
Public Static String Printattribute ( Object OBJ)
{
Stringbuilder strbuilder = New Stringbuilder ();
// Attribute combination
Foreach (Fieldinfo Field In OBJ. GetType (). getfields ())
{
If (Field. fieldtype! = Typeof ( Byte [])
{
Strbuilder. appendline ( String . Format (" [{0}]: {1} " , Field. Name, field. getvalue (OBJ )));
}
Else If (Field. getvalue (OBJ )! = Null )
{
Strbuilder. appendline ( String . Format ( " [{0}]: {1} " , Field. Name, commonutility. bytearraytohexstring (( Byte []) Field. getvalue (OBJ ))));
}
}
// Property combination
Foreach (Propertyinfo Property In OBJ. GetType (). getproperties ())
{
If (Property. propertytype! = Typeof ( Byte [])
{
Strbuilder. appendline ( String . Format ( " [{0}]: {1} " , Property. Name, property. getvalue (OBJ, Null )));
}
Else If (Property. getvalue (OBJ, Null )! = Null )
{
Strbuilder. appendline ( String . Format ( " [{0}]: {1} " , Property. Name, commonutility. bytearraytohexstring (( Byte []) Property. getvalue (OBJ, Null ))));
}
}
ReturnStrbuilder. tostring ();
}
# Endregion