Questions tagged as '.net'

2
answers

How to create methods in an enum?

I have a Java application and I'm porting it to C #. I have a question regarding enum that seems to work differently than Java. After you have asked a question here on the site ( Enumerations can contain abstract methods? ), whenever poss...
asked by 17.04.2016 / 06:54
3
answers

Use of using versus full name

I've been following many open source projects and noticed that there is a fairly large switch between using using ( Imports in VB.NET) and using direct reference to namespace . Example: void Main() { System.Int32 i...
asked by 17.07.2015 / 19:04
5
answers

The rest of the code inside the Try runs after encountering Exception?

The rest of the code within a try is executed after finding a exception or skips directly to the code within catch(Exception e) try{ x = 10; //alguns erro de try catch x = 20; } catch (Exception e) { x++; Message...
asked by 17.10.2016 / 13:00
3
answers

Picking up part of the phone

At registration, the user registers his phone and this field is masked (99) 99999-9999 and this is saved in the BD. if I want to use only the DDD of this, and the numbers separated, how should I proceed? in case I wanted DDD 99 Number 999999999....
asked by 03.11.2016 / 03:19
4
answers

"Date.now ()" equivalent of Javascript in C #?

Here talks about getting milliseconds using Date.now(); , which returns something like 1533144170651 . Follow his documentation:    The now () method returns the milliseconds since 1 January   1970 as of 00:00:00 UTC so far...
asked by 01.08.2018 / 19:38
1
answer

What does @ do in the name of the variables?

In the response code this question in SOen I found an unfamiliar statement line in C #. I tested this line and it works, but I did not understand the meaning of this @ character behind the member name. // declara "@foo" como uma strin...
asked by 08.08.2018 / 06:49
2
answers

Why are implemented methods of an interface can not be private?

When I implement an interface in my class, why its implemented methods can not be private / protected / etc? And another doubt, when I implement an interface method explicitly, why can not this method be public ? Example: interface...
asked by 17.04.2015 / 00:27
2
answers

How does GroupBy work in LINQ?

I'm having trouble understanding the GroupBy operator in LINQ.     
asked by 26.08.2015 / 21:23
2
answers

When is it advisable for a class to implement IDisposable?

I use the IOC standard in my project which facilitates the procedure call of type Resolver.Resolve<IPedido>().GerarPedido() , but I did not want to leave it "loose" in this way, I would like to implement the method IDisposable...
asked by 15.11.2015 / 18:27
2
answers

Method to execute when destroying instance of a class

Is there any way to automatically execute a method by destroying an instance of a class. I have a generic SQL class, where in the constructor I call a method that opens the connection. Only I want to close this connection automatically too, with...
asked by 20.11.2014 / 13:30