Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9210063
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:59:06+00:00 2026-06-18T00:59:06+00:00

I am trying to reference some random users generated in one class I made

  • 0

I am trying to reference some random users generated in one class I made in another class where I am going to use them.

public static void RandUserName(string domain, string FullName, string Email)
            {
                string firstName = "";
                string lastName = "";
                string phone = "";
                RandomUserName(domain, firstName, lastName, Email, phone);
                FullName = String.Format("{0} {1}.com", firstName, lastName);
        }

Public static void RandName(string FirstName, string LastName)
        {            
            string[] maleNames = new string [1000]{"aaron", "abdul", "abe", "abel"}; 
            string[] femaleNames = new string [1000] {"abby", "abigail", "ada"};
            string[] lastNames = new string[1000] {"abbott", "acevedo", "acosta"};

Random rand = new Random(DateTime.Now.Second);
            if (rand.Next(1, 2) == 1)
            {
                FirstName = maleNames[rand.Next(0, maleNames.Length-1)];
            }
            else
            {
                FirstName = femaleNames[rand.Next(0, femaleNames.Length-1)];
            }
        }

 public static string RandomUserName(string Domain, string FirstName, string LastName, string Email, string phone)
        {
            RandName(FirstName, LastName);
            if (string.IsNullOrEmpty(Domain))
            {
                Domain = String.Format("{0}{1}.com", FirstName, LastName);
            }

            Email = "Tester" + LastName + "@" + Domain;
            phone = "850-555-1234";
            return FirstName;
        }

Here is where I want to reference these names to in VB.net. I am trying to translate this to c#, these come from a request I am making:

                RandInfo.RandomUserName(Domain, .PrimaryContact.FirstName, .PrimaryContact.LastName, .PrimaryContact.Email, .PrimaryContact.Phone)
                RandInfo.RandomUserName(Domain, .BillingContact.FirstName, .BillingContact.LastName, .BillingContact.Email, .BillingContact.Phone)
                RandInfo.RandomUserName(Domain, .TechContact.FirstName, .TechContact.LastName, .TechContact.Email, .TechContact.Phone)
                RandInfo.RandomUserName(Domain, .EmergencyContact.FirstName, .EmergencyContact.LastName, .EmergencyContact.Email, .EmergencyContact.Phone)

Sorry if all this is confusing! Please ask any questions you have to understand and help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T00:59:07+00:00Added an answer on June 18, 2026 at 12:59 am

    First of all: i think you may have misunderstood the concept of functions/method. The void in your ‘RandUserName’ function is where you would declare the return type.

    A small example:

    public string GetFullName(string firstName, string lastName)
    {
        return firstName + " " + lastName;
    }
    

    A call like this:

    GetFullName("John", "Doe")
    

    would return “John Doe”. An (ugly) alternative way would be to declare the parameters in your methods as out parameters, but i would try to avoid that.

    What you want to achieve can be done in various way, i would start with designing a User class with properties for FirstName, LastName, Phone and so on.

    Then you could create a function that generates instances of this class, its properties filled with random values.
    But i guess you would have to put some effort into it for yourself.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As the questions states, I'm trying to reference some cells from one sheet to
I'm trying to use the static library however when I add the reference and
I am trying to reference some child entities with part of the parents composite
I'm trying to style some Drupal output. In particular, I'm trying to reference a
This is the code from the class within which I am trying to reference
I'm getting a Can't use an undefined value as a HASH reference error trying
I was just trying to display a progress bar. I found some reference code
I have a jsp page that is trying to reference some user defined classes.
I'm trying to reference another object I've defined in a Spring config file from
Currently, when trying to reference some library code, I'm doing this at the top

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.