What is the best way to do a string conversion to void without complications.
I tried to use this code but NullException
appears
private void Mainform_Load(object sender, EventArgs e)
{ var method = "public void MSG(object o){ MessageBox.Show(o); }";
method.GetType().GetMethod("MSG").Invoke("MSG", new object[] { "ZZZ" }); //Exception Aqui
}
But it returns the following:
HomeOnLocation(VS2012)thefollowingappears:
Mycaseisasfollows.Iwanttodevelopalauncherforagame,butthislaunchershouldbedonebasedonSortedDictionary<int,Acion>
actionswhereintistheactionidandActionistheactionbasedonastringmethodthatisconvertedtoit.
AndinanXMLwouldbeallthedetailedactions:
<?xml version="1.0" encoding="utf-8" ?>
<!-- DO NOT EDIT THIS FILE OR ALL OF THE FUNCTIONS EVEN BECOME INVALID AND UNSTABLE. IN THE CASE MAY RESULT IN SYSTEM FAILURE, AMONG ALL OTHER ERRORS IN COMMON. -->
<rels>
<rel id="0" exec="play_button" />
<rel id="1" exec="reg_button" />
<rel id="2" exec="home_button" />
<rel id="3" exec="clan_button" />
<rel id="4" exec="shop_button" />
<rel id="5" exec="forum_button" />
</rels>
Where rel is declaring the new action, id is the id in int and exec informs the SortedDictionary who should execute the function.
And when he prepares to perform the action:
public async void executar_acao(int id){await Task.Run(lista_de_acoes[id]);