Veja a seguir as conversões numéricas implícitas. Conversões que não estejam na tabela a seguir, você deve utilizar o type cast.
/* De | Para */ byte | "short, ushort, int, uint, long, ulong, float, double, decimal" char | "ushort, int, uint, long, ulong, float, double, decimal" float | "double" int | "long, float, double, decimal" long | "float, double, decimal" sbyte | "short, int, long, float, double, decimal" short | "int, long, float, double, decimal" uint | "long, ulong, float, double, decimal" ulong | "float, double, decimal" ushort | "int, uint, long, ulong, float, double, decimal"
Agora vejamos as conversões do tipo explícitas que o podem ser realizadas pelo programador:
/* De | Para */ byte | "char, sbyte" char | "byte, sbyte, short" decimal | "byte, char, double, float, int, long, sbyte, short, uint, ulong, ushort" double | "byte, char, decimal, float, int, long, sbyte, short, uint, ulong, ushort" float | "byte, char, decimal, int, long, sbyte, short, uint, ulong, ushort" int | "byte, char, sbyte, uint, ulong, ushort" long | "byte, char, int, sbyte, short, uint, ulong, ushort" sbyte | "byte, char, uint, ulong, ushort" short | "byte, char, sbyte, uint, ulong, ushort" uint | "byte, char, int, sbyte, short, ushort" ulong | "byte, char, int, long, sbyte, short, uint, ushort" ushort | "byte, char, sbyte, short"
Deixe um comentário