[RESOLVED] Different Type of Fuction Call - Convert From C#
Hi, I have a small project in c# to Paste from ClipBoard to DataGridview. In that areas, I need to convert the below
codes, which is very confusion..
Code:
private Dictionary<int, Dictionary<int, string>> ClipBoardValues(string clipboardValue)
{
Dictionary<int, Dictionary<int, string>>
copyValues = new Dictionary<int, Dictionary<int, string>>();
String[] lines = clipboardValue.Split('\n');
for (int i = 0; i <= lines.Length - 1; i++)
{
copyValues[i] = new Dictionary<int, string>();
String[] lineContent = lines[i].Split('\t');
//if an empty cell value copied, then set the dictionary with an empty string
//else Set value to dictionary
if (lineContent.Length == 0)
copyValues[i][0] = string.Empty;
else
{
for (int j = 0; j <= lineContent.Length - 1; j++)
copyValues[i][j] = lineContent[j];
}
}
return copyValues;
}
Thanks for the helps
Thanks Again
Re: Different Type of Fuction Call - Convert From C#
And where, specifically, lies the problem? To me that function doesn't really look any spectacular (at first sight).
Re: Different Type of Fuction Call - Convert From C#
Hi Eri, Thanks for your reply. I get confused to convert the below three lines only
Code:
private Dictionary<int, Dictionary<int, string>> ClipBoardValues(string clipboardValue)
{
Dictionary<int, Dictionary<int, string>>
copyValues = new Dictionary<int, Dictionary<int, string>>();
}
Again & Again Thousands of thanks for your guidances...
Re: Different Type of Fuction Call - Convert From C#
There's still no type alias for System::String in C++/CLI and declaring variables of reference types requires the ^ to denote a tracking handle, as opposed to a value type instance. (You seemed to already have noticed these in http://forums.codeguru.com/showthrea...15#post2153515). These type syntax rules apply to generic type parameters as well. And you need gcnew to instantiate reference types instead of new. Hence:
Code:
private:
Dictionary<int, Dictionary<int, String ^> ^> ^ClipBoardValues(String ^clipboardValue)
{
Dictionary<int, Dictionary<int, String ^> ^> ^copyValues = gcnew Dictionary<int, Dictionary<int, String ^> ^>;
// ...
}
(Assuming this is inline-defined inside a class body and you've got using namespace directives for System and System::Collections::Generic.)
(Not compiled, let alone tested, may contain plain typos and careless omissions.)
Re: Different Type of Fuction Call - Convert From C#
Thank Eri, I get clear.....All your replies are very nice...
Thanks Again