I have a c++ class that is very simple
struct Pt_t
{
T x, y;
template <class T2> operator Pt_t<T2>() { Pt_t<T2> pt = {x, y}; return pt; }
};
That allows me to create a pt that has T as any type i want. I can also do Pt_t<s8> = Pt_t<u64>;
without a problem. How do i do the same in C#? i tried the below and got an error
class Pt<T>
{
public T x, y;
//between operator and <T2>, error CS1031: Type expected
public static implicit operator<T2> Pt<T>(Pt<T2> v) {
Pt<T> r = new Pt<T>();
r.x = v.x;
r.y = v.y;
return r;
}
}