Questions tagged as 'c#'

2
answers

Convert string to DateTime in LINQ

I have a model where all fields are string . I want to convert to DateTime and Double For this I created a new model public class CPUStats { public DateTime Data { get; set; } public Double? Disco { get; s...
asked by 16.03.2016 / 14:41
3
answers

Similar types but with different objects. What is the best way to use it?

I had to create a new object but totally equal to that existing in the C # system. Since the objects are the same I tried to do: ObjetoOriginal.Propriedades = ObjetoClone.Propriedades; Unfortunately it does not work, does it? I tried the...
asked by 13.01.2017 / 00:17
3
answers

How does initializing fields in constructors work?

In the C # documentation it is written:    If a class does not have a constructor, a default constructor is automatically generated and default values are used to initialize the object fields. That is, if a class does not have a construct...
asked by 01.02.2016 / 20:39
2
answers

Entity Framework WITH (NOLOCK)

We can use the NOLOCK feature in SELECT , thus avoiding locks with INSERT SELECT COUNT(Descricao) FROM Produtos WITH (NOLOCK) Would there be any way to use WITH(NOLOCK) in the Entity Framework?     
asked by 22.02.2017 / 17:08
1
answer

Filter in DropDown using C # MVC 4

I have a dropdown in my view that I fill in as follows: ViewBag.NfeStatus = EnumHelper .ListAll<NfeStatus>() .ToSelectList(x => x, x => x.Description()); My NfeStatus model is an enum: public enum NfeStatus {...
asked by 17.01.2017 / 12:33
2
answers

Run Windows Prompt commands and save the output to a text file

I have a program that launches a Windows Prompt command. I want to copy the output of this command and save it to a text file. Example: The command is ipconfig and I want the output to be copied to a file.     
asked by 08.06.2015 / 10:50
5
answers

Read XML file in C #

I have a problem when reading an XML file in C #. In this this is a file of a pre-sale, and I have the following situation: in my xml I will have several pre-sales, and each pre-sale may have several items. So far so good, I'm able to identify t...
asked by 30.01.2015 / 20:39
2
answers

How to create operators in C #?

How to create a C # operator? For example, There are operators like: * multiplicacao / divisao % percentual The question is: How can I create my own operator? For example: 100 ~ 2 = 200.8 Where ~ would be my operator that...
asked by 29.09.2015 / 05:50
3
answers

Map Many to Many in the Entity Framework

I have a problem mapping with the Entity Framework. I have two models, "project" and "company", where in the "company" there can be several "projects". public class Projeto { [Key] public int Id { get; set; } public string Nom...
asked by 18.04.2017 / 14:28
2
answers

What is the maximum size of an object in 32 and 64 bits?

Specifically the array can have up to 4 billion elements, I think, and the most common element size sizes should be 4, 8, or 16 bytes. I ask, what is the maximum size that the object can occupy in memory? Would it be 4 GB in 32 bits? Is it u...
asked by 24.04.2017 / 16:45