How can I get the data type of a variable in C#?

前端 未结 8 824
忘了有多久
忘了有多久 2020-11-27 04:32

How can I find out what data type some variable is holding? (e.g. int, string, char, etc.)

I have something like this now:

using System;
using System         


        
8条回答
  •  醉梦人生
    2020-11-27 05:19

    Use the GetType() method

    http://msdn.microsoft.com/en-us/library/system.object.gettype.aspx

提交回复
热议问题