Questions tagged as '.net'

2
answers

.NET Code Protection

I have a C # application that I developed, it will be installed on multiple clients. The problem is that I have to protect the code of the application, because I did some tests with the application ILspy and all the source code is exposed. Anyon...
asked by 20.07.2016 / 19:42
2
answers

Can I use class and struct at the same time?

I have a "Address" variable, however, it is made up of "Street", "Number" and so on. The way I did below is the best one to do? With class and struct at the same time? Or is there something better and simpler to do? public struct...
asked by 28.09.2016 / 15:49
2
answers

How to declare a function inside another function in C #?

In Delphi it is possible to declare function within the block of a given function, see this example done in Delphi: procedure TForm1.btnRunClick(Sender: TObject); begin mostrarNome('Carvalho'); end; function TForm1.mostrarNome(nome: String)...
asked by 24.05.2016 / 03:20
2
answers

Collision of names between class and namespace

Is it wrong, bad practice or can I have problems with class equal to namespace ? Example: namespace Cielo { public class Cielo { } } It has worked, in some places it gets a bit strange to call Cielo.Cielo.etc . Should...
asked by 29.04.2016 / 20:08
2
answers

How to determine the last element of a list in a foreach?

Given any list, how do I know if foreach is in the last element? There are a few ways to do this, the most I can see is to save the last element and check if the current element is the same, but in that way it is necessary to check eve...
asked by 30.06.2016 / 16:07
3
answers

How to intercept exceptions when working with the Entity Framework?

I want to handle the errors returned by the Entity Framework. In this example I'm forcing the insertion of a duplicate record (Name already in the database where the column of the table is configured as a Unique Index ): [HttpPost] [Validat...
asked by 13.06.2014 / 02:31
2
answers

How to multiply an "X" character as many times as you want?

Is there a method that multiplies an "X" character as many times as I want? example: I have the "P" character    P x 5="PPPPP" Is there a ready method in .Net?     
asked by 26.02.2016 / 15:42
3
answers

LINQ corresponding to SQL with LIKE clause 'XXX%'

I'm using the following LINQ to return a query: .Where(c => c.Nome.Contains(nome)).OrderBy(c => c.Nome) But if the name is Maria , it brings: José Maria Maria José How to bring organized as if executing SQL query? So: WHE...
asked by 12.10.2015 / 21:38
2
answers

Trigger event only once

I'm doing an interface in Visual Studio 2015, how do I perform an event only once? For example: private void textBox5_Click(object sender, EventArgs e) { textBox5.ForeColor = Color.Black; textBox5.SelectAll(); textBox5.Text =...
asked by 08.04.2016 / 19:31
2
answers

How to count lines of code in a .NET solution?

What are all (free or not) solutions for counting lines of code in a .NET solution? Use two Visual Studios: 2012 and 2013.     
asked by 13.03.2014 / 20:04