string.Format()
considers each ‘{‘ or ‘}’ to be part of a placeholder (like ‘{0}’ you already use). You need to escape each literal occurrence by doubling it.
So in your case do:
string tmp = @"
if (UseImageFiles) {{
...
}}";
More Related Contents:
- Using non-literal strings in different methods in C#
- Get a Windows Forms control by name in C#
- Color different parts of a RichTextBox string
- How do I write a backslash (\) in a string?
- ComboBox.SelectedText doesn’t give me the SelectedText
- Int to string: cannot convert from ‘method group’ to ‘string’ [closed]
- import csv file to sql database in c# window application without header row [duplicate]
- How to trim after 1 letter from space C#? [closed]
- WinForm Application UI Hangs during Long-Running Operation
- How do I parse a string with a decimal point to a double?
- How do I make a WinForms app go Full Screen
- How to Merge DataGridView Cell in Winforms
- How to return a value from a Form in C#?
- Is using a Mutex to prevent multiple instances of the same program from running safe?
- How to detect when a windows form is being minimized?
- It is possible to copy all the properties of a certain control? (C# window forms)
- How do I get around the “‘” problem in sqlite and c#?
- CRUD Operations using DataGridView, DataTable and DataAdapter – Cannot add new row to DataGridView
- Image is not drawn at the correct spot
- Interaction between WebBrowser Control and Windows Forms
- How to change listview selected row backcolor even when focus on another control?
- How to extend C# built-in types, like String?
- Dynamic button creation & placing them in a predefined order using c#
- How can I dynamically change auto complete entries in a C# combobox or textbox?
- DataGridView Using SortableBindingList
- Any trick to use opacity on a panel in Visual Studio Window Form?
- How do I create 5 buttons and assign individual click events dynamically? [closed]
- How to create a User Control with rounded corners?
- Replace non-numeric with empty string
- semi-transparent form but opaque Controls in C#