Questions tagged as '.net'

2
answers

What is the 'let' statement in a LINQ query?

I have the following LINQ query: var source = from em in query select new { Id = em.UniqueID, Data = em.Data == DateTime.MinValue ? "" : em.Data.Value.ToString("dd/MM/yy HH:mm")...
asked by 14.12.2015 / 17:15
2
answers

Get information stored in an "attribute"

In the ORM I use, classes are mapped using Attributes . I need to retrieve the value stored in them. Ex.: [Table("CADASTRO_CLIENTE")] public class Cliente { [Property("Id")] public int Id { get; set; } } Example usage (fiction...
asked by 11.12.2015 / 12:04
1
answer

Use IEnumerable or ICollection?

I want to create a 1x N mapping using the fluent API Entity Framework , something like: a shopping cart has several products. In my cart class, I have a navigation property , which is a collection of products: public class Produto {...
asked by 14.03.2017 / 12:41
1
answer

Using Concat to concatenate array of strings

I was looking at strings and that they are immutable and can not be added to them in pain under penalty of being too slow. The recommendation is to use StringBuilder . But I also saw that there is a version of Concat () that accepts...
asked by 20.03.2017 / 14:45
2
answers

How to map and get only one property or field of a query?

I'm using Dapper to map object properties . See a practical example: var servico = conexao.Query<Servico>(statement.ToSql(), new { IdServico = id }).First(); That is, the Servico object will have all its properties mapped a...
asked by 29.01.2017 / 16:07
1
answer

Is there a binary tree in .NET?

I do not know if it's hidden somewhere and I did not see a binary tree structure in .NET. I searched the documentation for all Collection , including sub-levels and nothing. Are not you? Why not have something so important?     
asked by 03.04.2017 / 14:19
2
answers

What is syncblock?

I received a response that spoke about a syncblock . Why is it necessary? From what I understand, what I researched is competition control. But why does every object need it if not everyone will have competition?     
asked by 28.04.2017 / 16:34
3
answers

I need to validate a TXT layout in C #

I have a TXT file where I need to validate the number of characters in each column as per the layout of each document. Note: The documents are all in a single file *.txt In the second column is the document type "0000,0400,0430". Ea...
asked by 27.06.2016 / 23:04
2
answers

How to save program, database, or configuration file settings?

In my application, the admin user can make some settings, for example: Set whether you want to use certain product templates, or leave it open for the end user to type. Configure whether to use TIPE table, or whether NCM will be open for t...
asked by 18.10.2016 / 12:19
1
answer

#if DEBUG always runs, even in release mode

I'm trying to use the #if directive so that a given method runs only after it is published (in release mode). The code is something like #if !DEBUG AlgumMetodo(); #endif I've also tried to add ConditionalAttribute to th...
asked by 27.01.2016 / 13:11