There is two variable was assigned the value of "003" and "00 3". And it was convert to byte[] as below.
Before:
myStr1 = "003"; // valid, there is no blank inserted.
myStr2 = "00 3"; // invalid, there is one blank character or multi blanks character inserted.
在转换后,如果发现有空白特性,则源体将改成星体。
myVal1 = "3"; // valid after convert
myVal2[0] = 0; // invalid, since the source myStr2 is invalid.
myVal2[1] = 1; // same as above.
现在,我需要根据换算结果确定消息来源是否有效或无效。 我很想知道,如何说结果是一阵列。 请让我提出一些建议。 提前感谢。
显示SourVal型源价值
if (ResultVal is Byte Array) // how to translate the statement to C# code?
SourVal is Invalid;
else if (ResultVal is still String type) // how to translate the statement to C# code?
SourVal is valid;
ps: I failed to try the methods of typeof() and gettype() at my practice. I don t know how to use the methods. Or there is other better method for my validation.