Export a string

RobinJ 276 Reputation points
2020-11-23T20:39:18.923+00:00

Hi,
How can i use the string "server_token_string" outside of the using?

                using (StreamReader sr = new StreamReader(@$"{localappdata}\Liquid Aqua\API\server_token.txt", Encoding.Default))
                {
                    StringBuilder server_tokens = new StringBuilder();

                    // schreibt Zeile für Zeile auf den StringBuilder bis das Ende der Datei erreicht ist
                    while (!sr.EndOfStream)
                        server_tokens.AppendLine(sr.ReadLine()); fortschritt_label.Content = "Reading Server File..."; progress_bar.Value = 6;
                    string server_token_string = Convert.ToString(server_tokens);
                }
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,561 questions
0 comments No comments
{count} votes

Accepted answer
  1. Viorel 114K Reputation points
    2020-11-23T20:42:57.323+00:00

    Try something like this:

    string server_token_string;
    
    using ( . . .)
    {
       . . . 
       server_token_string = server_tokens.ToString( );
    }
    
    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful