![]() ![]() ![]() For example, the file myFile.cs might not be a C# source file. Check the path and the spelling of the file name.ĭo not rely on the name of a file to determine the contents of the file. The file doesn't exist or doesn't exist at the specified location.The following conditions may cause an exception: If you are not using the text files from How to write to a text file, replace the argument to ReadAllText and ReadAllLines with the appropriate path and file name on your computer. You can choose any text on your computer screen regardless of its source, such as a website or document on your hard drive. Choose the text you want your Mac to read to you. Keep the console window open in debug mode.Ĭonsole.WriteLine("Press any key to exit.") Ĭopy the code and paste it into a C# console application. Make sure the volume on your Mac is turned on or is set to a loud enough volume to hear the Text to Speech method. Use a tab to indent each line of the file. String lines = Display the file contents by using a foreach loop. Read each line of the file into a string array. String text = Display the file contents to the console. file name to substitute text files of your own. The files used in this example are created in the topic The files that are used in this example are created in the topic How to write to a text file. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |