This is because there are not the types
byte()
or
integer()
in C#, and, in VB.NET, they can be the arrays of those integer values.
There are types
byte
,
int
and a lot more. "Conversion" you need is done by assignment. This is because the set of values if the type
byte
is a subset of that of the type
int
. You need type case to assign the value if
int
variable to
byte
variable.
As to arrays of different numeric types, they cannot be assigned compatible at all. Do I need to explain what would happen if such cast would be possible?
(I explained it in more general terms of sets of values, not
ranges, because not all numeric types have ranges, floating-point types work differently and include Infinity and Not-a-Number values. Still, they have assignment compatibility rules. But integer types have ranges. "Range" is a bad, sloppy term which became a universally used computing jargon; correct term for set of values is "domain".)
Also,
int
and
byte
are actually alias names for
System.Int32
and
System.Byte
. All numeric types have alias names, to make the code independent from the
System
namespace.
Please see:
http://msdn.microsoft.com/en-us/library/ae55hdtk%28v=vs.110%29.aspx[
^],
http://msdn.microsoft.com/en-us/library/ms173105.aspx[
^],
http://msdn.microsoft.com/en-us/library/s2dy91zy.aspx[
^],
http://www.fmsinc.com/free/NewTips/NET/NETtip6.asp[
^].
See also this CodeProject article:
Cheat Sheet - Casting in VB.NET and C#[
^].
What to do? Review the types of variables you use in your ASP.NET construct.
—SA