Questions tagged as 'c#'

2
answers

Is there a correct way to comment a snippet of code?

Is there a proper way to comment on a snippet of code? For example: // Esconde a tela this.Hide() or would be: this.Hide() // Esconde a tela or until: this.Hide() // Esconde a tela Is there any kind of convention for this?     
asked by 20.09.2016 / 15:58
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
3
answers

Disable maximizing and minimizing of windows form

I need a solution to disable the maximize and minimize buttons in a windows form. Using WPF these two attributes would solve: WindowStartupLocation="CenterScreen" ResizeMode="NoResize" But now I need it to be in a windows form. Here is the...
asked by 14.04.2015 / 15:19
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 to add static methods in interface?

I have my following method: public static CloudStorageAccount GetAccount() And in my Interface : public interface IAzureStorangeService { CloudStorageAccount GetAccount() } But the compiler accuses that the method was...
asked by 18.11.2014 / 16:31