Use double braces {{
or }}
so your code becomes:
sb.AppendLine(String.Format("public {0} {1} {{ get; private set; }}",
prop.Type, prop.Name));
// For prop.Type of "Foo" and prop.Name of "Bar", the result would be:
// public Foo Bar { get; private set; }
More Related Contents:
- Making a List in C# with three flexible elements in one datatype
- How can I convert String to Int?
- How do I get a consistent byte representation of strings in C# without manually specifying an encoding?
- .NET String.Format() to add commas in thousands place for a number
- In C#, should I use string.Empty or String.Empty or “” to intitialize a string?
- C# string replace does not actually replace the value in the string [duplicate]
- How do I replace the *first instance* of a string in .NET?
- Convert a list to a string in C#
- Best way to repeat a character in C#
- Are there any Fuzzy Search or String Similarity Functions libraries written for C#? [closed]
- Get the index of the nth occurrence of a string?
- Is there a C# case insensitive equals operator?
- Remove text in-between delimiters in a string (using a regex?)
- Characters in string changed after downloading HTML from the internet
- Getting hash of a list of strings regardless of order
- Memory Efficiency and Performance of String.Replace .NET Framework
- Parse C# string to DateTime
- Easier way of writing null or empty?
- How can I get a character in a string by index?
- What is the difference between .Equals and == [duplicate]
- What’s a good way of doing string templating in .NET?
- Truncate string on whole words in .NET C#
- Is there a “String.Format” that can accept named input parameters instead of index placeholders? [duplicate]
- Convert binary string into integer
- DateTime conversion from string C#
- Why only literal strings saved in the intern pool by default?
- Checking for null before ToString()
- What does the @ prefix do on string literals in C#
- Why does the default string comparer fail to maintain transitive consistency?
- Does any one know of a faster method to do String.Split()?