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

  • SEARCH
  • Home
  • 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 6975459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:22:15+00:00 2026-05-27T17:22:15+00:00

I have a simple model public class OneModel { public string Email { get;

  • 0

I have a simple model

public class OneModel
   {
      public string Email { get; set; }

      public string Name { get; set; }
   }

And I created a simple list (OneModel datatype):

List<OneModel> someLists = new List<OneModel>{
            new OneModel{Name="A 1", Email="a1@some.com"},
            new OneModel{Name="A 2", Email="a2@some.com"},
            new OneModel{Name="A 3", Email="a3@some.com"},
            new OneModel{Name="B 1", Email="b1@some.com"},
            new OneModel{Name="C 1", Email="c1@some.com"},
  }

I want to create another list with random concatenated Name from first list, like as:
List<string> ... {"A 1-A 3", "A 2-C 1",...} or something like that.

How to do that ?

  • 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-05-27T17:22:15+00:00Added an answer on May 27, 2026 at 5:22 pm

    Assuming .NET Framework 4.0:

    var random = new Random();
    var result = new List<string>();
    var count = random.Next(10, 20); // How many results do you want, really!?
    for (int i = 0; i < count; ++i) {
        var query = from item in someLists
                    order by random.Next()
                    select item.Name;
        var items = query.Take(2);   // I assume you want two "names" in each item
        result.Add(string.Join("-", items));
    }
    

    Examine result for your random-length list of random randomness…

    But what do you need it for…?

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

Sidebar

Related Questions

I have a model public class Person { public string Name { get; set;
I have a simple Model: public class MyModel { public string Text{get;set;} } I
I have cratet simple Model public class ModelTest { public string MyValue { get;
I have the following model: public class Person { public string Name { get;
I have simple item model with name and quantity: public class Item extends CouchDbDocument{
I have a simple model like this one: class Artist(models.Model): surname = models.CharField(max_length=200) name
I need some help with this one.... I have this simple model: public class
I have a simple model for a contract: public class Contract { public int
I have a simple test application: Model: public class Counter { public int Count
I have a simple model namespace StackOverflow.Models { public class Test { public Test()

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.