Questions tagged as 'c#'

1
answer

How to restrict inheritance types from a hierarchy level?

Given the hypothetical model below: public abstract class Veiculo { public Motor Motor { get; set; } } public class Aviao : Veiculo { } public abstract class Motor { } public class MotorCarro : Motor { } public class MotorAviao : Motor...
asked by 24.06.2014 / 19:30
2
answers

C # - How to remove the Maximize, Minimize, but keep a Close button only?

I created a graphic component and wrote a command line that removed the control bar from the graphic component, but all the buttons disappeared. Is there any way to just leave the Close button? Or will I have that Form component type for an...
asked by 23.06.2015 / 21:57
3
answers

Breakpoint in visual studio does not load when debugging

I have a solution with 3 projects, one of them being Ex.utils and Ex.Api. Where the .dll of the utils project is referenced in Ex.Api in 'References'. Both compiled in the same .NET version. When you run the debug, the breakpoint, after count...
asked by 27.03.2018 / 17:56
2
answers

How to Fill a DropDownListFor

Can anyone help me how do I fill out a DropDownListFor ? Before I was doing it this way: @Html.DropDownList("lstAffiliate", string.Empty); But I saw that it was not recommended, so I decided to do it with ListFor . I have...
asked by 15.06.2015 / 19:28
1
answer

How to implement methods and classes by some keyboard shortcut in visual studio?

I need to implement methods and classes " by keyboard " to get a value automatically.    1: Implement Interface methods in the Start class: class Inicio : Interface { }    2: Put Get and Set automatically: private static RichTextBox...
asked by 19.01.2018 / 10:47
1
answer

How to pass parameter from one Controller to another in Asp.Net

Hello, I have an object that needs to pass by parameter to another Controller through RedirectToAction , I used TempData however after any page change it loses the reference, know of some solution so that it does not lose the referen...
asked by 16.05.2014 / 22:23
2
answers

How to change the value of a property given its name

In my program I have some classes where data is stored. For example Class1.alfa.dado = 66; Class1.beta.dado = 56; Class1.gama.dado = 37; The user will select one of the options that you want to change in a ComboBox, in this ComboBox are the...
asked by 18.08.2014 / 14:38
1
answer

Reflection Emit, what's the use?

Passing a code to MVC, I saw that there was a Label label= new Label(); that was underlined with red, when clicking to see the suggestions, I saw the following: using System.Web.Ui.WebControls using System.Reflection.Emit I was won...
asked by 07.07.2014 / 18:00
1
answer

What's the difference between using SaveChanges () only once after adding data through a foreach and using inside the foreach?

I'm inserting an average of 50,000 records into the database via Entity Framework. And I had a question regarding the following code placements: in the first (1) placement, I use foreach creating objects with their data and adding them (...
asked by 30.06.2014 / 17:00
2
answers

How to check if a class implements an interface, in C #?

How to check if a class implements an interface? For example, I want to include an if that checks whether an object is of type IDisposable. How to do? I tried something like: MinhaClasse meuObjeto = new MinhaClasse(); if...
asked by 25.08.2014 / 15:58