Questions tagged as '.net'

1
answer

Error performing LINQ query with equals at where closure

When you run the query below: public ActionResult GridViewPartial() { if (Session["cod_cli"] != null) { int cod_cli = Convert.ToInt32(Session["cod_cli"]); //var model = db.DadosTecnicos;...
asked by 31.07.2017 / 14:02
2
answers

Methods with more than one Generic [closed]

There is a possibility to create a method using more than one type of generic , more or less like this. public static TResult ToEntityForType<TResult>(this DataRow row, TType type) where TType : Type { TResult entity = A...
asked by 15.06.2017 / 15:11
1
answer

Can not convert from 'string' to 'System.IFormatProvider'

Follow the code (it works): var teste = 1; var teste1 = teste.ToString("000000"); Result:    000001 Here is another code (not working): var teste = "1"; var teste1 = teste.ToString("000000"); Result:    Can not convert from '...
asked by 26.04.2017 / 23:35
1
answer

Garbage collector is automatic?

I noticed that my application was deliberately consuming the memory even after the end of processing, even finalizing everything that was started so I called the GC.Collect(); and the memory was released. Garbage collector should not...
asked by 12.05.2017 / 22:46
2
answers

How to decrease TimeSpan time?

I need to set a time within TimeSpan , and make it shorten the time. When you get to [00:00:00], for the time. I need to do this format: [00:00:00] - hour, minute, and second. Below, I put 5 min. private void timer1_Tick(object sender...
asked by 08.02.2018 / 21:48
1
answer

How to organize namespaces?

I have heard that namespaces should be organized by layer, in this case, using some design pattern to make it possible, such as Projeto.Controller , Projeto.UI , Projeto.Model , however, if we look at the namespaces of own .N...
asked by 16.08.2017 / 22:26
1
answer

Why are you saying that this object is null?

papelX.moderador = abc.Id; papelX.participantes.Add(abc); I'm finding a NullReferenceException in this code above. I am creating a papelX object and will use some properties of the object abc . Visual Studio is saying that on...
asked by 23.06.2016 / 05:12
2
answers

Where to put the View Model rule

I need to create a View Model to use on the screen. I'm not sure where to put the button rule to be enabled or not. I thought of this implementation, I wonder if it's the best way. Another idea I had was to put the builder content in a...
asked by 05.12.2016 / 16:19
1
answer

Problem running eventhandler

I have a class, which is executed under a button, it makes two select in a bank. I am trying to do this with EventHandler , however, when running the system, it executes, but gives the error in the line: OnDataChange(info);...
asked by 05.06.2016 / 01:29
2
answers

Join two items from an IList in a single item by the Id

In my class it has: Id Venda Devolucao I have IList of this class, and in this IList has [0] classe Id = 100, Venda = 230.00, Devolucao = 0; [1] classe Id = 100, Venda = 0, Devolucao = 50.00; [2] classe Id = 101, Venda = 5...
asked by 08.06.2016 / 22:32