什么是C#中的.class(在Java中使用)的等价物

在Java中:

TokenStream my_stream = analyser_exclude.tokenStream(fieldName, my_reader); TermAttribute my_token = TermAttribute.getAttribute(TermAttribute.class); 

在VB.NET中:

 Dim my_stream As TokenStream = analyser_exclude.TokenStream("", my_reader) Dim my_token As TermAttribute = DirectCast(my_stream.GetAttribute(GetType(TermAttribute)), TermAttribute) 

我刚刚在VB.NET中更改了fieldname,因为我不需要它。 这段代码适用于VB.NET,但我不知道如何用C#更改DirectCast和最后一行代码(在Java中)Termattribute.Class

在C#:???

请帮助我,我不知道如何在C#中更改这些行。

你在找typeof

 TermAttribute my_token = (TermAttribute)my_stream.GetAttribute(typeof(TermAttribute));