- namespace AccountOrganizer
- {
- public class SetName
- {
- string[] MaleNames =
- { "Jack",
- "Micheal",
- "Mike",
- "Jordan",
- "James",
- "William",
- "David",
- "Richard",
- "Charles",
- "Daniel",
- "Kevin",
- "Brian",
- "George",
- "Edward",
- "Ronald",
- "Jason",
- "Jeffrey",
- };
- List<string> MaleNameList = new List<string>(MaleNames);
- Random r = new Random();
- int Random = r.Next(0, MaleNameList.Count());
- string sethename = MaleNameList[Random];
- }
- }
Getting a error while create a simple class
am i not allowed to create a list and a random object in a class?
Sachin SinghPosted Dec 21, 2020, 5:09 AM
Amit GuptaPosted Dec 21, 2020, 6:17 AM
Amit GuptaPosted Dec 21, 2020, 6:06 AM
osyris zosarPosted Dec 21, 2020, 5:01 AM
and why do i need to declare a method?
Sachin SinghPosted Dec 21, 2020, 4:45 AM