I have an incredibly unique problem here. Our business application has been built using c# and vb.net. We have been trying to approach a standard and trim the fat for some of our core, already duplicated, objects. We are getting really close, but when trying to consolidate a duplicate object into c# our vb.net code now starts throwing the error "Operator '&' is not defined for type 'CSType' and 'String', when I try to do vb.net string concatenation using the ampersand(&). The funny thing is that if I use the '&' in c# with CSType (after properly overloading it) i get the string concatenation I expect.
Here are my basic overloads on CSType:
public static string operator &(CSType c1, string s2)
{
return c1.ToString() + s2;
}
public static string operator &(string s1, CSType c2)
{
return s1 + c2.ToString();
}
When I run the '&' operator in c# with a CSType and a string, I get the expected results, when I attempt to execute that in vb.net the code will not compile giving me an error that:
"Operator '&' is not defined for types 'CSType' and 'String'"
CSType also implicitly converts to most data types, so I was thinking that there may have been some issue with the '&' assuming that it was a bitwise operator, but I would guess that would fails by giving me messed up execution, not a compile error.
Anyway, I'm of half a mind to place this class in c++ where I know I can get what I need out of it, but isn't 2 languages enough already.
&in C# overloads bitwise AND.