Questions tagged as 'c#'

1
answer

What is the use and when to use the preprocessor directives?

At some point I had seen the use of #define in C #. Today I searched about this and found its documentation here, but not answered all my doubts. Code sample with preprocessor directives: #define DEBUG #if DEBUG Console.Wr...
asked by 28.07.2017 / 17:23
1
answer

How does Visual Studio Edit and Continue work?

Visual Studio allows you to edit the C #, VB.NET, or C ++ code in debug when you hit a breakpoint or click the break button (pause icon). The tool name is Edit and Continue . According to the documentation    is a productivity feature that a...
asked by 25.10.2017 / 17:11
1
answer

Error comparing string [closed]

I'm trying to finish my last parts of the code, and I need to check the value of string , but I can not find any examples of how to handle it. I tried this code but the error appears:    Error 1 Can not implicitly convert type 'string'...
asked by 22.07.2017 / 00:22
1
answer

Parallelism and Entity Framework

I'm having some problems using parallelism (I'm not very knowledgeable in this area) with C # and Entity Framework. My scenario is as follows, I'm using an ASP.NET MVC application and inside it I have a list of objects that I do several valid...
asked by 22.12.2015 / 12:55
4
answers

How to avoid repetition in LINQ queries?

I have the following LINQ query that is in a method that returns all products: var query = from p in Produtos select new Produto { ProdutoId = p.ProdutoId, Descricao = p.Descricao, Preco = p.Preco, Estoq...
asked by 17.01.2016 / 16:04
1
answer

How to map a TIME-type column in Entity Framework 6?

I'm using this mapping for a DATETIME field of SQL Server: Property(X => X.DatNascimento).HasColumnName("DAT_NASCIMENTO").HasColumnType("datetime"); But I have another TIME field that I do not know how to configure: Property(X => X....
asked by 05.06.2015 / 15:45
1
answer

Entity Framework Update Database

When I run the command Update-Database I get the following error    Could not load file or assembly 'Microsoft.Build.Framework,   Version = 15.1.0.0, Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a 'or   one of its dependencies....
asked by 14.12.2017 / 12:03
1
answer

How to use expanded property in C #

I have a problem, I created a class containing the following property: public class MinhaClasse { public int Idade {get; set;} } However, when I do this: public class MinhaClasse { public int Idade { get{ return Idade;...
asked by 16.12.2017 / 22:06
1
answer

Enum as Object Value in DDD

After many searches on the internet, I came across many divergent opinions ... In my application, I created enum EstadoCivil {Casado = 1, Solteiro = 2, Divorciado = 3} . Can it be classified as an Object Value, or is it simply an enumer...
asked by 27.12.2017 / 12:13
2
answers

How to retrieve the description of an enumerator?

I have the following enumerator public enum MeuEnumerador { [Description("Descrição do item do enumerador")] Enumerador1 = 1, [Description("Outra descrição")] Enumerador2 = 2 } How do I get the value that is in the Descri...
asked by 20.11.2015 / 19:56