dovrebbe effettivamete essere come il codice che hai inviato.. ma in C#