1
Answer

Help with encoding and syntax

James

James

17y
2.3k
1
Hi,

I'm new to C# so please forgive this basic question.

I would like to insert a variable into the line below at System.Text.Encoding.Unicode

TextWriter tw = new streamWriter(fileName,false,System.Text.Encoding.Unicode);

I also want to use the following as variables:
System.Text.Encoding.ASCII
System.Text.Encoding.UTF8

I would like to assign each encoding as a variable so I can insert the variable I require.

Example:
TextWriter tw = new streamWriter(fileName,false,myVerUnicode);

How do I go about declaring the variables and using the variable in the above line?

Many thanks.
Answers (1)