Questions tagged as 'c#'

1
answer

Display value (decimal) without rounding

I have a database that has the following values: 48.205864 So, when I simply make a select , and bring it to the screen, it looks like this: 48,21 What do I need to do so that the value is not rounded up in C #, and disp...
asked by 28.09.2016 / 04:20
3
answers

HTML Helpers in ASP.NET MVC 4

I have seen some HTML Helpers like this: @Html.LabelFor(x => x) and @Html.LabelFor(model => model.Propriedade) , however, I do not understand this parameter that I should pass, x => x , what is this?     
asked by 08.11.2014 / 13:42
3
answers

Split to separate part of a string considers first separator

I have the following text:    _2910_0908_401 _600_ERV__P_119552_GUARITA ERV WITHOUT ENERGY RADIO INOPERAN_TE SEMAFOROS P TRENS AND VEICLS OFF_PSG TREM C FLAG SIGN BY GUAR_ITA I use Split to break every "_" itens = this.Entidade...
asked by 29.10.2014 / 13:39
4
answers

Parent class with the same responsibility as the child class

I have my Item class public class Item { public string Nome {get;set;} public decimal Valor {get;set;} public ICollection<SubItem> SubItens {get;set;} } public class SubItem { public string Nome {get;set;} public decima...
asked by 27.11.2014 / 22:43
2
answers

How important is the use of interfaces in Java or C #? [duplicate]

I know how to implement and use the interfaces, but I can not understand why they exist in C # or Java, since once you extend your class to an interface you need to implement all methods of the interface.     
asked by 23.07.2016 / 01:14
1
answer

How to do a foreach loop with limit in C #?

How can I do a foreach loop with boundary, for example I have a dictionary with 100 items and I want to loop item 20 up to 50 how can I do this in C #.     
asked by 18.06.2016 / 06:23
2
answers

Return original formatting TextBox

I have a method, which checks if a TextBox is filled, if it is normal, if it is blank, it displays a message on the screen, and it paints the background of the TextBox in yellow, Here comes my doubt, how do I return to the default color? Curr...
asked by 28.06.2016 / 05:55
2
answers

Error # CS0176 in if statement, what am I doing wrong?

Why am I getting error # CS0176 when I call the variable madeiras in (gamble.Equals("gamble {0}", madeiras)) ? By what I understand is because my method is static, and I need to put the name of your class, but the error persists...
asked by 27.08.2018 / 19:03
2
answers

Using interfaces for domain classes

Is it a good practice to make use of interfaces for domain class? Do I have an advantage doing this? If so, which one? Example: public interface IAuditoria { long AuditoriaID { get; set; } string Descricao { get; set; } string S...
asked by 25.07.2018 / 19:14
2
answers

How do I return an existing item in my enumerable via Contains?

I have an enumerable, and I want to query through one code per parameter. if the enumerable "Contains" Code, then it will return me all items that have that Code. See was trying to do so: public IEnumerable<Relacao> Listar(int Codigo)...
asked by 07.04.2015 / 13:47