Questions tagged as 'c#'

2
answers

Back previous position in Visual Studio

When we are wanting to see some method, we press F12 and soon we are "transported" to that method. It turns out that this method can be in another project or another form or in a user control and so forth comes the question. Is there any short...
asked by 23.12.2014 / 19:35
1
answer

Format value with Brazilian currency mask

I have a stored procedure that returns me a credit amount for a certain amount of consortium. The return of this value would look like this: 167900 . But it should look like this: R$ 167.900,00 . This value I feed a <...
asked by 23.01.2015 / 12:12
3
answers

When does not return Task in async methods?

Usually, in some time-consuming tasks, I use asynchronous methods: public async Task myLongRunningOperation(int i) { ... } However, in what situations do I not necessarily need to return a Task ? public async void myLongRunningOpera...
asked by 11.07.2017 / 04:02
2
answers

What is the main difference between int.Parse () and Convert.ToInt32 ()?

In C #, there are two ways (among others) to convert other types to int : Convert.ToInt32(valor) and Int32.Parse(valor) . What is the main difference between these two conversion methods?     
asked by 06.10.2015 / 18:41
2
answers

Ticket generation in .NET

To this day I have often imagined situations in which a system might need to generate boletos, although until now I have never developed anything like this, and so I decided to research how to do this in .NET. I researched a little and all I fou...
asked by 15.12.2015 / 19:42
1
answer

Control the CPU fan in C #

How do I read and set the fan speed of the CPU and also read the current speed? I tried to use this code but I did not get results either. [DllImport("Cimwin32.dll")] static extern uint32 SetSpeed(in uint64 sp); private void button1_Click(...
asked by 13.12.2013 / 11:44
1
answer

How to do a text break in Excel programmatically with a check in C #

I'm using Microsoft.Office.Interop.Excel to create an Excel report from a txt file. Everything works perfect, but sometimes some columns become extremely large and when we need to print, we need to resize and look horrible. When I t...
asked by 08.04.2016 / 20:11
3
answers

Why does Visual Studio suggest simplifying the names? - IDE0001 Name can be simplified

Visual Studio 2013 suggests simplifying names, as you can see below: The suggestion is:    IDE0001 Name can be simplified translating: IDE0001 Name can be simplified Example: var obj = new Object(); //Sugere a simplic...
asked by 11.08.2015 / 15:48
2
answers

How to Lambda in Extension Methods with multiple Lists?

There are the following Objects: public class Objeto1 { public List<Objeto2> PropObj1 {get; set;} } public class Objeto2 { public List<Objeto3> PropObj2 {get; set;} } public class Objeto3 { public int PropObj3 {get; set;...
asked by 10.08.2015 / 22:55
1
answer

What is the difference between Action, Predicate and Func

What's the difference between Action , Predicate and Func in C #? I would like examples of use if possible.     
asked by 01.10.2015 / 15:22