
c# - Options for initializing a string array - Stack Overflow
Sep 3, 2013 · What options do I have when initializing string[] object?
c# - Declare a const array - Stack Overflow
string isn't a char [], see the source. Strings can be consts in C# because the compiler will replace all references to the const with the actual string literal itself.
c# - How to initialize a list of strings (List<string>) with many ...
How is it possible to initialize (with a C# initializer) a list of strings? I have tried with the example below but it's not working. List<string> optionList = new List<string> { "
c# - How to define an enum with string value? - Stack Overflow
Dec 21, 2011 · You can't - enum values have to be integral values. You can either use attributes to associate a string value with each enum value, or in this case if every separator is a single character you could just use the char value: enum Separator { Comma = ',', Tab = '\t', Space = ' ' } (EDIT: Just to clarify, you can't make char the underlying type …
c# - Declare and assign multiple string variables at the same time ...
One can declare and initialize multiple variables in the following way nowadays: var (anInt, aFloat, aBoolean, aChar, aString, anArray, aRecordType, anObjectType) =
asp.net - How to create JSON string in C# - Stack Overflow
Jun 29, 2009 · I just used the XmlWriter to create some XML to send back in an HTTP response. How would you create a JSON string. I assume you would just use a stringbuilder to build the JSON string and them fo...
How do I declare an array of strings with an unknown size?
How is an array of strings where you do not know the array size in C#/.NET declared? String[] array = new String[]; // this does not work
Multiline string literal in C# - Stack Overflow
A string literal, on the other hand, is a piece of source code, not yet compiled, that represents the value used to initialize a string later on, during the execution of the program in which it appears.
How can I make my string property nullable? - Stack Overflow
Sep 30, 2015 · I don't understand the question. You left out a [Required] attribute which is basically all there is to it. The question should rather be: how can I make a string property not nullable when it's supposed to be required? I.e. CFName is the real challenge here. Using nullable reference types helps, but still doesn't enforce it.
c# - Best practice for constant string for implementations to use ...
May 5, 2016 · What is the best practice in OOP/Good Design to have a constant error_string that I can access in all of my implementations? the way it is right now, code is duplicated.