No one here mentioned the reason why you get the "System.Byte[]" string instead of the value, so I will.
When an object is implicitly cast to a String, the program will default to the object's public String ToString()
method which is inherited from System.Object
:
public virtual string ToString()
{
return this.GetType().ToString();
}
If you find that you are often making this conversion, you could simply create a wrapper class and override this method like so:
public override string ToString()
{
// do the processing here
// return the nicely formatted string
}
Now each time you print this wrapper object you will get your value instead of the value from this.GetType().ToString()
.