Naive question about Java syntax. What does
<T> T accept(ObjectVisitorEx<T> visitor);
mean? What would be the C# equivalent?
Naive question about Java syntax. What does
<T> T accept(ObjectVisitorEx<T> visitor);
mean? What would be the C# equivalent?
see Java: http://java.sun.com/j2se/1.5.0/docs/guide/language/generics.html
and C#: http://msdn.microsoft.com/en-us/library/ms379564(VS.80).aspx
A similar C# method could be
public T Foo<T>(Queue<T> v) // Queue<T> chosen for simplicity
{
return v.Dequeue();
}
This is used for passing types as parameters. C# syntax is the same (<Type>). Suggest googling for term 'generics' as this is the term you're looking for.
The C# equivalent would be more or less the same. If the visitor were an interface it would be
O Accept(IObjectVisitorEx<O> visitor);