Dictionary<string,
List<string>> dic = new Dictionary<string,
List<string>>();
List<string> myValues1 = new List<string>();
for (int i =
0; i < 50; i++)
{
myValues1.Add("KeyA" + i);
}
List<string> myValues2 = new List<string>();
for (int i =
0; i < 50; i++)
{
myValues2.Add("KeyB" + i);
}
List<string> myValues3 = new List<string>();
for (int i =
0; i < 50; i++)
{
myValues3.Add("KeyC" + i);
}
dic.Add("A", myValues1);
dic.Add("B", myValues2);
dic.Add("C", myValues3);
foreach
(KeyValuePair<string, List<string>> pair in dic)
{
string pk = pair.Key.ToString();
if (pair.Key == "A")
{
foreach (string d in pair.Value)
{
MessageBox.Show("Key:" + pair.Key.ToString() +
" Değeri: " + d.ToString());
}
}
}
You might look into the standard libraries if you find Dictionary and List equivalents implemented (I do not know the standard library). If not, you have to implement yours like many did. Below there is your example with use of my implementation.
-
Play videoPlease edit your post.
For large amounts of code, attach it - Not MQL4 code
- No question asked
- You have only four choices:
- Search for it,
- learn to code it,
- beg at Coding help - General - MQL5 programming forum or Need help with coding - General - MQL5 programming forum or Free MQL4 To MQL5 Converter - General - MQL5 programming forum,
- or pay (Freelance) someone to code it.
You might look into the standard libraries if you find Dictionary and List equivalents implemented (I do not know the standard library). If not, you have to implement yours like many did. Below there is your example with use of my implementation.
too long code ?.
string b11[20];
string SeyranGrup[20]={"aa","bb","cc","dd"};
b11[2]="Seyran"+"Grup[2]";
Alert(b11[2]);
result is SeyranGrup[2], i want to result is "cc".
too long code ?.
string b11[20];
string SeyranGrup[20]={"aa","bb","cc","dd"};
b11[2]="Seyran"+"Grup[2]";
Alert(b11[2]);
result is SeyranGrup[2], i want to result is "cc".
It does not look like C# code. You should open a new thread. Those, who could answer your query, would not enter a C# related thread.
result is SeyranGrup[2], i want to result is "cc".
"execute a string" -> https://www.mql5.com/en/forum/151309
![Execute a string as a method? Execute a string as a method?](/i/community/logo_mql5_small.png)
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Dictionary<string, List<string>> dic = new Dictionary<string, List<string>>();
List<string> myValues1 = new List<string>();
for (int i = 0; i < 50; i++)
{
myValues1.Add("KeyA" + i);
}
List<string> myValues2 = new List<string>();
for (int i = 0; i < 50; i++)
{
myValues2.Add("KeyB" + i);
}
List<string> myValues3 = new List<string>();
for (int i = 0; i < 50; i++)
{
myValues3.Add("KeyC" + i);
}
dic.Add("A", myValues1);
dic.Add("B", myValues2);
dic.Add("C", myValues3);
foreach (KeyValuePair<string, List<string>> pair in dic)
{
string pk = pair.Key.ToString();
if (pair.Key == "A")
{
foreach (string d in pair.Value)
{
MessageBox.Show("Key:" + pair.Key.ToString() + " Değeri: " + d.ToString());
}
}
}