I am trying to use CodeDom to produce the following line of code:
object o = (object)bytes
Where “bytes” represents a byte array: byte[] bytes = null;
I could use the VariableDeclaration method or possibly even the CodeAssign method to generate the left side of this line, but how can I create the right side of this line?
I am open to any suggestions – thank you!
Evan
That form of conversion is called casting. Conversion means something along the lines of
Convert.ToInt32("123"), orint.Parse("123").Cast (Your exact line
object o = (object)bytes;)Convert (My conversion sample
object o = Convert.ToInt32("123"))