Reputation:
In Java :
TokenStream my_stream = analyser_exclude.tokenStream(fieldName, my_reader);
TermAttribute my_token = TermAttribute.getAttribute(TermAttribute.class);
In VB.NET :
Dim my_stream As TokenStream = analyser_exclude.TokenStream("", my_reader)
Dim my_token As TermAttribute = DirectCast(my_stream.GetAttribute(GetType(TermAttribute)), TermAttribute)
I just changed the fieldname in VB.NET because I didn't need it. This code works in VB.NET but I don't know how to change the DirectCast in C# and the last line of code with (in Java) Termattribute.Class
In C# : ???
Help me please I don't know how to change those lines in C#.
Upvotes: 5
Views: 4747
Reputation: 210705
You're looking for typeof
:
TermAttribute my_token =
(TermAttribute)my_stream.GetAttribute(typeof(TermAttribute));
Upvotes: 15