2024年4月12日发(作者:)

int、()、32()区别...

直到自己亲自测试了才对他们有所了解,以前就知道用最后面那个,因为怕转化出

错,所以就用它比较安全。

:(int)变量,C#默认整型为int32;(不支持bool转化)

(string sParameter) 4个构造函数,参数类型只支持string类型;

32()支持的类型是object;

事例:

using System;

using c;

using ;

namespace IntegerSample

{

public class Program

{

private enum eNumber { Man = 1, Woman = 2 };

private static char cNumber = 'e';

private static byte btNumber = 12;

private static long lNumber = 12345;

private static double dNumber = 12.34d;

private static decimal dlNumber = 4.5m;

private static bool bNumber = true;

private static string str = null;

private static string str1 = "";

private static string str2 = "123";

private static string str3 = "Hello";

public static void TransformByInt()

{