Questions tagged as 'c#'

1
answer

Clear the console every 30s

How do I clean the console every 30s every time? I tried creating it with timer but it did not work, or I must have done it wrong. Here is the code: var time = new Timer(LimparConsole,null,0,30000); public static void LimparConsole (objec...
asked by 21.11.2017 / 18:59
1
answer

CRUD Generic in Entity Framework with entity not specified

I'm trying to make a Generic CRUD for my project. However as I used DataBaseFirst I do not see how to have a generic class of Entity that can be inherited. Well it does not make the slightest sense, eventually when I upgrade the bank, it would h...
asked by 17.11.2017 / 13:07
2
answers

Show error message when ModelState is not valid

When I submit the form it acknowledges that ModelState.Valid is invalid but when it returns View() does not show the error messages I put in Model . My Controller: [HttpPost] [ValidateAntiForgeryToken] public...
asked by 17.11.2017 / 13:30
1
answer

Product is a namespace but is used as a type [closed]

I have this error message:    Product is a namespace but is used as a type It was working and when I got compiled, I'm getting that error. How do I resolve this?     
asked by 20.03.2018 / 15:06
2
answers

How do I avoid having the file I created in txt write two equal C # files?

Well, I'll explain the problem to you: I have a system that reads the barcodes and in this system I need the txt file that is receiving the code do not receive duplicate / duplicate files, ie it can not receive the same code 2 times. I'm havi...
asked by 15.03.2018 / 16:06
1
answer

How to copy the summary of a method with Overload in C #

I'm creating an application where in classes I have a series of overload 's to optimize performance and flexibility. Ex: public class Calc { // método original com sumário /// <summary> /// soma "a" com "b" /// </s...
asked by 21.06.2018 / 16:05
2
answers

Define dictionary as constant

Follow the code below: var values = new Dictionary<string, string> { { "tipo1", "dada65d" }, { "tipo2", "546541354765321" }, { "tipo3", "klwoiqyhalwtbfowh" } }; How can I declare class Dictionary as constant ( co...
asked by 21.06.2018 / 01:46
1
answer

Save JSON file information to database

I think about the possibility of a Web system saving information from a register in a JSON file on the client device, and that would later be sent to the DB. This will happen when the client is in an environment where it is not possible to acces...
asked by 24.06.2018 / 23:51
1
answer

Syntax ElapsedEventHandler in System.Timers.Timer

There's a difference between starting a Timer like this: _timerExam = new Timer(); _timerExam.Elapsed += new ElapsedEventHandler(OnTimedEvent); _timerExam.Interval = 1000; _timerExam.Start(); And so? _timerExam = new Timer(); _time...
asked by 12.09.2017 / 19:51
2
answers

How to check if there are async processes running

Does anyone know of any way to check if a Async process is running? For example, I would like to do a check when the user closes the system, and do not close until all Async processes are complete. async public void EvokeMetod...
asked by 09.08.2017 / 20:04