Why does Type.IsByRef for type String return false if String is a reference type?

前端 未结 3 512
甜味超标
甜味超标 2021-01-01 23:36

According to this a string (or String) is a reference type.

Yet given:

Type t = typeof(string);

then

if (t.IsBy         


        
3条回答
  •  一个人的身影
    2021-01-01 23:59

    You want to check if it is a value type.

    typeof(object).IsValueType :- false
    typeof(int).IsValueType :- true
    

提交回复
热议问题