Linked Questions
12 questions linked to/from How to make C# switch statement use IgnoreCase?
4
votes
3
answers
18k
views
C#'s switch statement is case-sensitive. Is there a way to toggle it so it becomes case-insensitive? [duplicate]
C#'s switch() statement is case-sensitive. Is there a way to toggle it so it becomes case-insensitive?
==============================
Thanks,
But , I don't like these solutions;
Because case ...
1
vote
3
answers
15k
views
C# Switch statement [duplicate]
I'm new to programming
i started to learn C# language
Console.WriteLine("yes or no ?");
string answer = Console.ReadLine();
switch (answer)
{
case "yes":...
0
votes
3
answers
496
views
How to compare strings without case-sensitivity? [duplicate]
I'm writing a code where the user has to input if he wants a feature or not by pressing "y" or "n" or writting "yes" or "no", without checking for case-sensitivity (so it needs to work if the user ...
1
vote
0
answers
125
views
Switch statement case block not recognizing expected string value [duplicate]
I have a very strange issue occurring within a switch statement in C# inside of VS2013. The switch statement evaluates a string value and has several cases expecting specific strings. Some of the ...
0
votes
0
answers
37
views
C# user input case-insensitive using switch [duplicate]
using System;
namespace TakeHome
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("What is the opposite of black ?");
...
1472
votes
296
answers
762k
views
Hidden Features of C#? [closed]
This came to my mind after I learned the following from this question:
where T : struct
We, C# developers, all know the basics of C#. I mean declarations, conditionals, loops, operators, etc.
Some ...
151
votes
17
answers
127k
views
C# switch statement limitations - why?
When writing a switch statement, there appears to be two limitations on what you can switch on in case statements.
For example (and yes, I know, if you're doing this sort of thing it probably means ...
93
votes
4
answers
29k
views
What is wrong with ToLowerInvariant()?
I have the following line of code:
var connectionString = configItems.
Find(item => item.Name.ToLowerInvariant() == "connectionstring");
VS 2010 code analysis is telling me the ...
3
votes
4
answers
7k
views
Compare strings in C# in switch-case block with different casing [closed]
I have a set of switch-case statements, such as "Hello, how are you", "Hi, how can I help you?". If the input from the user is verbatim i.e: "Hello, how are you", the ...
6
votes
1
answer
7k
views
Using Switch case with Equals method in C#
Is there a way to convert the below if else condition into Switch in C#. I am using Equals method for checking the type, but unable to convert to switch case.
if (fi.FieldType.Equals(typeof(int)))
{
...
-1
votes
2
answers
163
views
Per-String function (IDK how it's called)
I'm working on my C# project,
and I need to do this, but without the If, in a short way;
for (String = n) do that
for (String = s) do those
for (String = c) do this
I don't know how it's called, or ...
-1
votes
2
answers
114
views
Replacing IF and Else If statements from my method [duplicate]
I need some help if it is a way to the below.
Scenario is that I have an incoming order on the backend machines. And before I can process it I need to do some stuff with the order before depending on ...