How do I make "foreach ( string TXTname in names)" a variable without the foreach or do I need the foreach?

How do I make "foreach ( string TXTname in names)" a variable without the foreach or do I need the foreach?

how to make
how to make a paper
how to make everything
how to make how to make
how to make car
how to make a robot
how to make toys with paper
how to make kite

So I am trying to store variables onto text files so my program can call on them later but I need the files to have set names and when I try that it never works correctly.

I've tried having the foreach loop in a foreach loop, I've tried so many things but all of them just screw over the variable data

string[] lines = { name, FirstBlock, MonIstem, WedIstem, ThridBlock, FourthBlock, "Design Time", SixthBlock, TueIstem, ThurIstem, EighthBlock, NinthBlock, "Design Time", FriIstem };
string[] names = { "name", "FirstBlock", "MonIstem", "WedIstem", "ThirdBlock", "FourthBlock", "Design Time", "SixthBlock", "TueIstem", "ThurIstem", "EightBlock", "NinthBlock", "Design Time", "FriIstem", };
foreach (string TXTname in names)
{
    Console.WriteLine($"Saving {TXTname}");
}
foreach (string line in lines)
{
    string getNameOfVar = nameof(line);
    using (FileStream bs = File.OpenWrite($@"C:\Users\gn193755\Documents\{TXTname}.txt"))
    {
        byte[] thing = new UTF8Encoding(true).GetBytes(line);
        bs.Write(thing, 0, thing.Length);
    }
}

No error messages but when I open the text file there is either only one text file, or they all have the same words on them, or they are just garbled text, I keep expecting there to be the correct file name with the correct text.


I am so dumb, I did more research and found the .zip thing.

               var lines = new [] { name, FirstBlock, MonIstem, WedIstem, ThridBlock, FourthBlock, "Design Time", SixthBlock, TueIstem, ThurIstem, EighthBlock, NinthBlock, "Design Time", FriIstem };
            var names = new [] { "name", "FirstBlock", "MonIstem", "WedIstem", "ThirdBlock", "FourthBlock", "Design Time", "SixthBlock", "TueIstem", "ThurIstem", "EightBlock", "NinthBlock", "Design Time", "FriIstem", };
            var linesAndnames = lines.Zip(names, (l, n) => new { Line = l, Name = n });
            foreach (var ln  in linesAndnames)
            {
              var path = $@"C:\Users\gn193755\Documents\{ln.Name}.txt";
              File.WriteAllText(path, ln.Line);
            }
        }

How Much Do Youtubers Make & How to Become a Youtuber, How many views do you need to get paid on YouTube? Find out how much do I make annually now by entering your hourly wage. You can also convert salary to hourly by entering your annual salary and your hourly rate will be shown. There is a formula on how to calculate how much you make a year using hourly rate on the bottom of the page.


As seen into the code the foreach loops are seperate.

string[] lines = { name, FirstBlock, MonIstem, WedIstem, ThridBlock, FourthBlock, "Design Time", SixthBlock, TueIstem, ThurIstem, EighthBlock, NinthBlock, "Design Time", FriIstem };
string[] names = { "name", "FirstBlock", "MonIstem", "WedIstem", "ThirdBlock", "FourthBlock", "Design Time", "SixthBlock", "TueIstem", "ThurIstem", "EightBlock", "NinthBlock", "Design Time", "FriIstem", };
        foreach (string TXTname in names)
        {
                Console.WriteLine($"Saving {TXTname}");

            foreach (string line in lines)
            {

                string getNameOfVar = nameof(line);
                using (FileStream bs = File.OpenWrite($@"C:\Users\gn193755\Documents\{TXTname}.txt"))
                {
                    byte[] thing = new UTF8Encoding(true).GetBytes(line);
                    bs.Write(thing, 0, thing.Length);
                }
            }
        }

Try using the above code

IT SHOULD BE IN EVERY HOME / HOW TO MAKE , How can I make a lot of money on YouTube? Convert my salary to an equivalent hourly wage. Use this calculator to determine what your hourly wage equates to when given your annual salary - it may surprise you what you make on an hourly basis. Also you may want to see if you have one of the 50 best jobs in America. You may also want to convert an hourly wage to a salary.


  1. You need to place, the second foreach within the first foreach.
  2. If they are string variables, as an experiment use the following to create your files
string getNameOfVar = nameof(line);
var path = $@"C:\Users\gn193755\Documents\{TXTname}.txt");
File.WriteAllText(path, line);

Try this, to ensure the line strings are written correctly:

var path = $@"C:\Users\gn193755\Documents\output.txt");
File.AppendAllText(path, line);

How Do I Make Money on YouTube?, Welcome to the channel Roman Ursu Hack ( romanursuhack ). Here you will learn how to do Duration: 5:56 Posted: Oct 11, 2019 wikiHow is where trusted research and expert knowledge come together. Since 2005, wikiHow has helped billions of people to learn how to solve problems large and small. We work with credentialed experts, a team of trained researchers, and a devoted community to create the most reliable, comprehensive and delightful how-to content on the Internet.


How to Make Money From Your Content on Facebook, Learn more about how viewers, creators, and advertisers make YouTube possible: http://goo.gl Duration: 2:31 Posted: Jun 10, 2014 Tony van Veen is the CEO of DIY Media Group, the parent company of Disc Makers, Merchly, and BookBaby.As a college student, he played in indie bands, created his own LPs, cassettes, and t-shirts


Easy Homemade Simple Syrup, Welcome to the channel Roman Ursu Hack ( romanursuhack ). Here you will learn how to do Duration: 12:15 Posted: Jul 4, 2017 Make sure to clearly that we do our order a top-notch work services. Teen books is an excellent opening for burdens on such a. Forgotten how they with us you will be offered to work paper when they were.


Good Old Fashioned Pancakes, Get an overview of three ways to earn money from your videos and content on Facebook: in-stream ads, Branded Content, and Fan Subscriptions. Limoncello is a sweet, lemon-flavored Italian liqueur. Unlike many liqueurs, it's very easy to make at home, requiring only the most basic of ingredients and tools. Doing so is easy but rewarding--from a scientific perspective for the chemistry involved in the process, and from a culinary perspective for the simple joy of drinking something you made from scratch.