G
Guest
I want to overload the + operator for ArrayList for adding elements
public static int operator +(ArrayList l, Object o)
return (l.Add(o))
First I have discovered that the return value cannot be void and if I change it to something like int, I have to always write like this
int i = list + 3; // I don't need
The compiler doesn’t accept jus
list + 3
is there a workaround? I just want to write
list + 3
as a statement and not an expression
public static int operator +(ArrayList l, Object o)
return (l.Add(o))
First I have discovered that the return value cannot be void and if I change it to something like int, I have to always write like this
int i = list + 3; // I don't need
The compiler doesn’t accept jus
list + 3
is there a workaround? I just want to write
list + 3
as a statement and not an expression