-2

I am trying to declare an equivalent of this code in c#:

public T FieldValueOrDefault<T>(int columnIndex);

I am using managed C++ Visual Studio 2015. If it matters, Target Platform Version is set to 8.1 and CLR Support set to /clr. When I enter something like this:

generic<typename T>
T FieldValueOrDefault<T>(String^ columnName);

I get a compiler error "Error C2768 FieldValueOrDefault': illegal use of explicit template arguments"

Please let me know what is a correct way to declare such thing.

Ðаn
  • 10,934
  • 11
  • 59
  • 95
Andrey Belykh
  • 2,578
  • 4
  • 32
  • 46

1 Answers1

3

It should be, as pointed out here:

generic<typename T>
T FieldValueOrDefault(String^ columnName);

The <T> is superfluous.

Emil Laine
  • 41,598
  • 9
  • 101
  • 157