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.
Loading
AlanPosted Nov 18, 2007, 7:10 PM
To use a variable, try:
using System.Text;
......
Encoding myVerUnicode = Encoding.Unicode;
TextWriter tw = new streamWriter(fileName, false, myVerUnicode);
The declaration of the other variables would be:
Encoding myVerAscii = Encoding.ASCII;
Encoding myVerUtf8 = Encoding.UTF8;