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 8778897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:38:32+00:00 2026-06-13T19:38:32+00:00

I have a C# problem at the moment that I haven’t been able to

  • 0

I have a C# problem at the moment that I haven’t been able to get my head around. Essentially I need to generate a list or array of strings which are sentences based on the fact that in the sentence, one or more words may have different spellings or uses. I intend to have a number of different possibilities for (potentially) each word in the sentence.

For example if I define that the word ‘are’ could be written as ‘are’ or ‘r’ and the word ‘you’ be written ‘you’ or ‘u’, expected output for passing something along the lines of “how are you” would be:

  • “how are you”
  • “how r you”
  • “how are u”
  • “how r u”

I’ve considered that I could use Enums for word types, e.g:

public enum Word  
{  
  Are,  
  You  
}  

and return an array of possible uses using some kind of helper method:

public static string GetVariants(Word w)  
{
 switch(w)
 {
   case Word.Are:
   return new string[] { "are", "r" };
   case Word.You:
   return new string[] { "you", "u"};
 }

But I cannot seem to find a decent way to define a sentence using a mix of fixed strings and these variable word type identifiers and create possible combinations.

The words need to be in the right order as they would be written, I just need to be able to generate a number of different ways of writing the same thing. Once I’ve got something going with this, I’d also like for it to be not just applicable to this particular sentence structure. Is this possible?

  • 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-13T19:38:34+00:00Added an answer on June 13, 2026 at 7:38 pm

    Incase anybody comes across a similar problem, I eventually got this working as I wanted using a hack of Eric Lippert’s Cartesian Product solution:

    http://blogs.msdn.com/b/ericlippert/archive/2010/06/28/computing-a-cartesian-product-with-linq.aspx

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

Sidebar

Related Questions

I am playing around with cuda. At the moment I have a problem. I
I need to get the last inserted id of table that have multi-column primary
I have a bizarre problem at the moment, I am just making a start
I have a problem and I am stack. If anyone have a spare moment
I'm building a micro site at the moment and I have a problem. I
The following code summarizes the problem I have at the moment. My current execution
I'm having a blonde moment, here is my problem: Break down: I have an
Lets say that I have a drop down list that I want to create
I have a problem at the moment and am not sure what I should
I haven't been able to find any satisfactory coverage of this topic all in

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.