Try as I might, I cannot convert this Managed C++ code to C++/CLI. Can someone give a pointer (pun intended)?
static String *ignoreStrings[];
Later in the code, an Add(string) method is called on it. Elsewhere, in some C# code,
new String[]{"foo", "bar"}
is passed into a function that is somehow cast into the type of ignoreStrings above.
I've tried this syntax:
static array<String^> ^ignoreStrings;
But it can't cast from that C# array, and it doesn't have an add method either.
Edit: More complete code in the hopes that this changes the question somehow...
private:
static String *ignoreStrings[];
public:
void AddIgnoreString(String *ignore)
{
AddOneIgnoreString(ignore);
}
void SetIgnoreStringData(String *ignore[])
{
SetIgnoreStrings(ignore);
}
static void SetIgnoreStrings(String *ignore[])
{
ignoreStrings = ignore;
}
static void AddOneIgnoreString(String ^ignore)
{
ignoreStrings->Add(ignore);
}
Elsewhere, from C# code, this call is made:
SetIgnoreStrings(new String[]{"foo", "bar"});
This is what I tried to convert the C++ code to:
private:
static array<String^> ^ignoreStrings;
public:
virtual void AddIgnoreString(String ^ignore)
{
AddOneIgnoreString(ignore);
}
virtual void SetIgnoreStringData(array<String^> ^ignore)
{
SetIgnoreStrings(ignore);
}
static void SetIgnoreStrings(array<String^> ^ignore)
{
ignoreStrings = ignore;
}
static void AddOneIgnoreString(String ^ignore)
{
ignoreStrings->Add(ignore);
}
static array<String^> ^GetIgnoreStrings()
{
return ignoreStrings;
}