Questions tagged as '.net'

1
answer

Log with historical debug (IntelliTrace)

I have a WPF application and am looking for the best way to solve unhandled exceptions. Today, when an unexpected exception occurs, deal in event Application.DispatcherUnhandledException . There, I write the Exception.StackTrace...
asked by 08.02.2017 / 02:05
1
answer

Convert SQL query to LINQ

What would be the converted SQL query for LINQ: "SELECT SUM(valor_negocio) valor_negocio, " + " MONTHNAME(STR_TO_DATE(MONTH(data_inicio), '%m')) mes," + " STATUS" + " FROM negocio" + " WHERE data_inicio BETWEE...
asked by 04.11.2017 / 20:26
3
answers

Round numbers in C # being the decimal place 0 or 5

I need to round numbers in such a way that they have only one decimal place worth 0 or 5. For example 1 -> 1 1.1 -> 1.5 1.4 -> 1.5 1.5 -> 1.5 1.6 -> 2 2 -> 2 Does anyone know of a simple way to do this?     
asked by 17.05.2014 / 18:29
2
answers

When I type broken number, it removes the comma and sums as integer

static void Main(string[] args) { Console.Write("Digite sua primeira nota: "); double n1 = Convert.ToDouble(Console.ReadLine()); Console.Write("Digite sua segunda nota: "); double n2 = Convert.ToDouble(Cons...
asked by 13.09.2017 / 06:24
2
answers

How to make a switch in C #?

I see a lot of people saying it's wrong to switch in the code because it ends up weighing and it's ugly. Is it correct the way I'm using it and what would be an alternative to using it? Fill in the code for if / else ?...
asked by 29.11.2018 / 12:06
5
answers

Get object in array by description in index

Is it possible to use the property of an object as an index of an array , as described in the example below? using System; public class Program { public static void Main() { var myObjectArray = new MyObject[]{ new...
asked by 24.11.2017 / 12:53
4
answers

Create list with more than one element as if it were multidimensional

I need to receive these pairs of data from the database, and I'm thinking of a way to bring the values without having to create an object, as I find it unnecessary in this case. Is it possible to create a list<string,string>...
asked by 13.08.2018 / 16:53
2
answers

Arc tangent function in C #

I made the following calculations on the calculator: arctg(50/10) = 78,69° However, when doing in code, using the function Math.Atan , the result is as follows: Is there any other way to do the Tangent Arch calculation?     
asked by 16.02.2017 / 20:16
3
answers

How to replace the number of letters of a word with a character?

I'm doing a hangman game, let's suppose I type the name "john" in a text box, shortly after I press a button and I want it in the "text 2" box to appear " _ _ _ _ ", then I want the same number of underlines to appear as the number of letters....
asked by 03.06.2017 / 20:40
3
answers

Is it possible to offer return options in a method?

As I already know there is overload in creating the methods, which are example, a method where you have the option of passing 2 or 3 parameters calling the same function: //Soma 2 numeros public int Somar(int a, int b) { return a + b;...
asked by 14.08.2017 / 20:24