Questions tagged as 'c#'

3
answers

Why use regions in C #?

What are the advantages and disadvantages of using #regions in C# ? Does your use really make it easier to organize your code? #region /* Código */ #endregion     
asked by 17.03.2014 / 19:52
1
answer

What is it that allows a method to be intercepted in C #?

Intercepting a method is a technique that can be used to execute a code snippet before executing a master action. That is, in a very simplified way this would also be an example of interception: public void A(){ Console.Writeline("Estou a...
asked by 08.02.2017 / 19:55
1
answer

Why should I use the StringBuilder class instead of the String class?

Why these two classes are different, as it seems to me that they could be a single class. For example, the method Append , it seems to me that it does the same thing as the + operator.     
asked by 03.10.2015 / 03:14
4
answers

Should I use a "try-catch" to identify if a password is wrong?

In the login screen, I check the bank with select , and I'm using catch to catch this exception. Is it correct to use catch for this type? if (Usuario != string.Empty && Password != string.Empty) {...
asked by 21.07.2016 / 16:04
5
answers

Test for string padding

When I read a post about good programming practices, more related to validating string fills, I came across the following: Check too slow: string ret = String.Empty; if (string.IsNullOrEmpty(ret)) Slow check: string ret = String.Empt...
asked by 29.08.2018 / 14:03
3
answers

How can I replace a part of a string by itself plus the character "~"?

How can I replace a part of a string with itself plus the "~" character? I am doing this as follows: only when the string has two equal numbers like the 51 that comes shortly after AP and the contained in 17 51 3322 Replace does...
asked by 15.06.2016 / 20:49
1
answer

How to create a login page and password in ASP.NET?

I'm trying to create a login control for my application but I'm not finding a way to do this. I would like it to be a full login control, where I could register new users, retrieve their passwords, etc. Can anyone give me a hint how to do thi...
asked by 17.06.2014 / 05:59
1
answer

How does Linq's Aggregate () extension method work?

I recently saw some examples that used the Aggregate() of namespace System.Linq method, but I could not find any good explanation of how to use it. What does this method do and how should it be used?     
asked by 06.10.2015 / 15:22
2
answers

Relationship N for N and One for N with CodeFirst Data Annotations

How can I make the N to N and N to N relationships using Data Annotations? For example: A sales move has a user, and a user can have multiple moves. This same sales movement has several products, and each product can be in several movem...
asked by 21.06.2014 / 03:35
2
answers

How to access the print screen image?

When we press the Print Screen key on our keyboard, the screen image is saved in some memory cache, somewhere, because when we give Ctrl V after, in Paint for example it apararece, how to access the location and "catch" the image from ther...
asked by 05.05.2014 / 14:04