C# 属性

C# 抽象

C# 字符串

C# 泛型

C# 杂项

C# 新特性

C# GetType() 对象的类型字符串

C# GetType() 方法用于获取当前对象的类型。它返回用于反射的 Type 类的实例。

签名

句法 (Syntax)

public Type GetType()

参数

它不带任何参数。

返回

它返回 Type 类的对象。


C# String GetType() 方法示例

例子 (Example)

using System;    
public class StringExample    
{    
    public static void Main(string[] args)    
    {    
      string s1 = "Hello C#";  
      Console.WriteLine(s1.GetType());  
    }    
}

输出:

System.String


  • 使用社交账号登录,本站支持
全部评论(0)