Questions tagged as 'c#'

1
answer

C # - How to print all the values of an array with the command Console.WriteLine (???) ;?

// Make an array copy and print the 2. int[] original = new int[] { 2, 5, 3, 8, 9, 12, 15, 7 }; int[] copia = new int[original.Length]; for (int index = 0; index < original.Length; index++) { cop...
asked by 26.05.2018 / 14:40
1
answer

How to make this FOR (in C #) list only the top five items?

I have an ordered list, that I need to display only the first 5 items, not all the bank records, so I'm not getting it. Here is my code as it is: public class DashboardController : Controller { private NFeWebContext db = new NFeWeb...
asked by 28.05.2018 / 16:00
1
answer

Problems with javascript in ASP.Net applications MVC - Minification failed

I just uploaded my system to the server, so I went to do the first tests and this is causing the following errors in my Javascript scripts /* Minification failed. Returning unminified contents. (1,1): run-time error CSS1019: Unexpected token,...
asked by 11.07.2018 / 22:22
1
answer

Error trying to create a Controller or ApiController

I created an empty Asp.Net Core 2.0 project (without scaffold). Model DDD and etc. But when I try to create my controller, it is inherited from ApiController or Controller, it gives error:    Controller is a namespace, but is used as a type...
asked by 18.06.2018 / 16:56
1
answer

How to merge sublists of a class and return the result using Linq and C #

Hello, I'm working with C # and I have the following situation: I have 2 classes in the system, Order and ProductSold ; Order contains as property List<ProductSold> ; In a given ViewModel, I have to get a...
asked by 20.07.2018 / 14:18
1
answer

List items other than the database in the Combobox in C # winforms

I have a C # application that performs a search. For this is used a field called 'status' that nothing else a list in a combobox. I need it to appear in addition to the statuses that come from the bank, a status called 'ALL' that does not exist...
asked by 04.07.2018 / 03:36
2
answers

Back to previous page - mvc page razor

I'm trying to get back to the previous page, like this: string urlAnterior = Request.Headers["Referer"].ToString(); if (urlAnterior.Contains("Pagina")) return RedirectToAction(""); else return RedirectT...
asked by 03.07.2018 / 16:56
1
answer

C # - High memory consumption when calling method

I'm working with a main Form and it has several Panels. In one of them, the "general panel" I use to call instances of new forms and show on it using the following code from the FormCall class: public void chamaFormulario(Form form) {...
asked by 28.05.2018 / 20:49
2
answers

How is the syntax of generics in C # compared to Java?

I am a Java developer studying C # and I came across the following difference between the two languages:    link       Generics       Generics are much less fiddly in C #. Partially because they are both compile-time and run-time concept....
asked by 18.05.2018 / 20:20
1
answer

Call action with button click passing parameter

I will have 3 buttons, each with a different id, how do I pass this id to the action of my controller when it is clicked? public IActionResult Index(int id) { var lista = _listaService.sites(id); return View(lista); }...
asked by 21.09.2018 / 02:28