Questions tagged as 'c#'

2
answers

Alternative for Switch within Switch

I'm making a decision structure that depends on more than one variable, but readability and maintenance using if or switch are bad. What alternatives do I have for this case? Example of% nested% nested: switch (var1) {...
asked by 01.06.2016 / 00:58
3
answers

Private property set in an interface [duplicate]

I'm modeling a C # interface that has a property. However, I want to ensure that all classes that implement this interface keep the setter as private: public interface IBar { string Id { get; private set; } } This code does not comp...
asked by 21.08.2017 / 16:28
3
answers

How to separate a String according to a tab in C #?

I have a string in this format: string valores = "Numero1#Numero2#Numero3#Numero4#"; How do I debit it in an integer array to get this: int Numero[1] = Numero1; int Numero[2] = Numero2; int Numero[3] = Numero3; int Numero[4] = Numero4;...
asked by 02.05.2014 / 19:07
4
answers

Get random element from a ListT

I have List<int> numeros Is it possible to return a random element from this list?     
asked by 09.07.2014 / 16:12
3
answers

How to find out the C # version I'm using?

I would like to know how I can find out the C # version I am using.     
asked by 22.03.2018 / 13:36
3
answers

C # function error to increment variable

I'm new and I have some "basic" questions. I am doing a point counter, because many players want to create the function decrement / increment. Increment function public void incremento(int pt, int mago) { pt++; sw...
asked by 11.03.2014 / 05:25
2
answers

What better way to organize and work with routes in ASP.NET MVC?

What better way to organize and work with routes in ASP.NET MVC? While we have 1, 2 routes, it's quiet, but when do we get 500? 600? In a corporate application there are many routes, what is the best way to organize them without losing contro...
asked by 07.08.2014 / 23:56
3
answers

How to add Directory to the Windows Path variable during installation?

I developed a Console application in C # with Visual Studio 2013 and wanted the installer to add the solution directory to the Windows Path variable during installation. It is possible? What is the procedure to perform this change in th...
asked by 22.05.2015 / 21:24
4
answers

How to check the variables that are not used?

There is some way to check which variables are not used within the scope > of a class? As in the example below, the variables test1 and test4 have no utility within the application, how could it find such variables? using System; using...
asked by 26.10.2016 / 20:27
3
answers

I need to sort a list in order that seems incoum

I have a query and I want to sort this query by the code attribute. I did this: consulta.OrderBy(c => c.Codigo); Result obtained: 1.01 1.A 14.04 14.11 22.01 3.04 30.01 4.01 40.02 Expected result: 1.01 1.A 3.04 4.01 14.04 14.11 22....
asked by 19.12.2016 / 20:34