c# Repeat for all variables within Class

Hi guys.

I recently noticed that xmlSerialization takes all Variables of a Class and does tomething repetitive with it.

Now my question is: How could I do such a Thing too?

because I'm currently programming a cheap Employee Manager that has some repetitive parts in it such as this:

 Console.CursorLeft = 12; SendKeys.SendWait(chosen.JobTitle); chosen.JobTitle = Console.ReadLine(); Console.CursorLeft = 12; SendKeys.SendWait(chosen.Firstname); chosen.Firstname = Console.ReadLine(); Console.CursorLeft = 12; SendKeys.SendWait(chosen.Familyname); chosen.Familyname = Console.ReadLine(); 

It basically does the same thing over and over again just with other Objects.

Is there any way I could create like or something with pointers in it and then just a foreach loop?

This would be very helpful, thanks 🙂

by Jonas_Dralle via /r/csharp

Leave a Reply