Writing to Text and XML Streams
Learn about writing to text streams and XML streams with examples of writing call signs to text and XML files.
We'll cover the following
Writing to text streams
Let’s type some code to write text to a stream:
Step 1: Use your preferred code editor to add a new Console App or console project named WorkingWithStreams
to the Chapter09
solution or workspace.
In Visual Studio, set the startup project for the solution to the current selection.
In Visual Studio Code, select
WorkingWithStreams
as the activeOmniSharp
project.
Step 2: In the project file, add an element to statically and globally import the System.Console
class.
Step 3: Add a new class file named Program.Helpers.cs
.
Step 4: In Program.Helpers.cs
, add a partial Program
class with a SectionTitle
method, as shown in the following code:
Get hands-on with 1400+ tech skills courses.