I'm currently in a c# class and wanted a full explaination of every line in this short code. I can see what happens in the form but I don't fully know how to explain it since some parts copied from the internet (new char[] for example) and how all of them work together. Thanks in advance would be a great help!
private void BtnSkapa_Click(object sender, EventArgs e)
{
int längd = int.Parse(tbxLängd.Text);
var lösen = new char[längd];
string tecken = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!#¤%&?<>£${[]}§+@£$";
Random random = new Random();
for (int i = 0; i < längd; i++)
{
lösen[i] = tecken[random.Next(tecken.Length)];
lblLösen.Text = new string(lösen);
}
}
}
Aucun commentaire:
Enregistrer un commentaire