Hi guys,
Ive created a user control ascx page and I want to use the StringBuilder class as follows:
However, when I run the main page that uses this user control I get this error pointing to the code "envVer.Append(Environment);":
I don't understand what Im doing wrong? Can someone please help?
Ive created a user control ascx page and I want to use the StringBuilder class as follows:
Code:
<script language="C#" runat="server">
// Initialise variables
public String Environment = "Dev";
public String Version = "0.1";
protected StringBuilder envVer = new StringBuilder();
public String Content = "";
// Create environment title string
envVer.Append(Environment);
envVer.Append(" ");
envVer.Append(Version);
</script>
However, when I run the main page that uses this user control I get this error pointing to the code "envVer.Append(Environment);":
Code:
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS1519: Invalid token '(' in class, struct, or interface member declaration
I don't understand what Im doing wrong? Can someone please help?