Is possible to add warning symbol in C#? [duplicate] - c#

This question already has answers here:
How to write Unicode characters to the console?
(5 answers)
Closed 4 years ago.
i want to ask if is possible to add in a string the "⚠" character and make it executable in console with Console.WriteLine().

you can use this code;
System.Console.OutputEncoding = System.Text.Encoding.Unicode;
Console.WriteLine("⚠");

Related

How to generate a random number that is different from an existing number? [duplicate]

This question already has answers here:
How do I generate a random integer in C#?
(31 answers)
How to get a random number from a range, excluding some values
(11 answers)
Select from a range but exclude certain numbers [duplicate]
(7 answers)
Closed 5 years ago.
I know this question sounds like a duplicate, but I haven't found an answer to it yet. Let me know, thanks.
For example:
a = 50
b = random
But b can never be the same as a

reuse interpolated strings [duplicate]

This question already has answers here:
String Interpolation with format variable
(7 answers)
Closed 7 years ago.
Has anyone figured out how to reuse an interpolated string?
I.e. can anyone figure out how to do away with the string.Format in the following block of code?
foreach(var s in new[]{ "Primary_{0}_Home", "Secondary_{0}_Work" }){
sql = $"SELECT {string.format(s, "Street")}, {string.format(s, "City")} ..."
}
You can't do that.
Interpolated strings are set on compile time. You can't use string interpolation to load a string to format something not directly in the scope.

C# remove elements in list starting with # [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
How to remove elements from an array
I have an List with a bunch of data in it. Some of the lines start with a #. I want to remove those lines.
How...?
assuming its a string List
myList.RemoveAll(x => x.BeginsWith("#"));

Difference between bool/Boolean, string/String etc [duplicate]

This question already exists:
Closed 12 years ago.
Possible Duplicate:
String vs string in C#
What is the big difference between these datatypes? and were should I use it?
Short answer, there is no difference. They are just alias of each other, see
http://msdn.microsoft.com/en-us/library/ya5y69ds(VS.80).aspx for a complete list.
Have a look at: String vs string in C#

C# Double.ToString() [duplicate]

This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
Custom numeric format string to always display the sign
To format a double to certain precision in C# I write this:
d.ToString("#0.00");
What if I want to force a the sign to appear..
e.g
+2.54 and -2.54
Hope this will work.
YourDoublenumber.ToString("+#;#");

Categories

Resources