Questions tagged as 'c#'

2
answers

How to create a list of dates with specific day

I'm working on ASP with MVC 4, and I create a list of dates from the data entered by the user. For example, the user enters the day of the month in which a certain occurrence will be made. It also inserts the start date where it will start and t...
asked by 04.02.2014 / 11:19
1
answer

Is it correct to use a using block inside another using block?

Is it correct to use a block using within another block using as in the example below? or is it enough to just put the first using ? public DataTable Listar(string stringMySql, CommandType commandType, List<MySqlPara...
asked by 02.12.2015 / 15:07
4
answers

How to simulate "tail recursion" in C #?

In .Net, I know that it is possible to make cause calls because the F # compiler, when optimizing code, transforms a function with tail recursion into a function with a loop, thus avoiding stack overflows. To make it clearer, I'll use a factoria...
asked by 03.02.2014 / 19:46
1
answer

What is the difference between "throw" and "throw ex"?

I saw that C # allows you to do ... try { //algum código } catch { throw; } too ... try { //algum código } catch (Exception ex) { throw ex; } and ... try { //algum código } catch (Exception) { throw; } My q...
asked by 28.09.2014 / 18:06
2
answers

What's the difference between: UrlEncode, EscapeUriString, and EscapeDataString

And which of the three is equivalent to encodeURIComponent of JavaScript? String: 'apostrophe' "double quotes" StackOverflow! string teste = "'apóstrofo' \"aspas duplas\" StackOverflow!"; HttpUtility.UrlEncode(teste); // %27ap%c3%b3...
asked by 24.07.2014 / 14:19
2
answers

Why is AddRange much faster than Add?

I'm working on a data integration between two bases, and I'm using Entity Framework for this. I then generated the following code, which iterates each record in the Situations table of base dbExterno and feeds my base db :...
asked by 11.12.2013 / 18:36
2
answers

How to check if a file is in use without throwing C #

I have an application that processes a file queue. I need to open the files for reading and writing. Sometimes the files are in use when I process them. How can I check if the file is in use? Today I deal more or less like this. I cr...
asked by 14.02.2014 / 18:08
2
answers

What does "!" mean before a code snippet?

There are many basic things that I do not know, for example how to read exactly this exclamation in the following way: if (!(periodoAnterior.Equals(dataReader["NOMEPERIODO"].ToString()))){ //... } Can anyone explain me? And taking advan...
asked by 25.04.2014 / 19:16
3
answers

Doubt about the responsibility of a get ()

Is it acceptable to have a getter method that gets a parameter to be able to have a return variance? Example: getAllNome("M"); <- retorna tudo que for masculino. getAllNome("F"); <- retorna tudo que for feminino. getAllNome(); <- re...
asked by 28.03.2014 / 21:12
1
answer

What do I need to sell a system in C #

If I want to sell a system as stand-alone in C # language, do I need some microsoft license? Any special records? Any specific contracts? Do I have any limitations?     
asked by 27.03.2014 / 20:21