Most voted "c#" questions
This tag should be used when the question refers to some resource, information or problem related to the C#language. C# ("C Sharp") is a multi-paradigm programming language that has strongly typed variables, is imperative, declarative, functional, generic, object-oriented and component-oriented, which are designed to be executed in . NET Framework.
Learn more…13,899 questions
Sort by count of
-
2
votes1
answer67
viewsHow to work with more than one dependency on Service class?
I have my class Service calling for GrupoService, in it are most of the shares that refer to a Grupo. Crud(Inserir,Alterar,Excluir,Listar) The only dependency I have in my class so far is the…
-
2
votes2
answers52
viewsList group only that contain items
And an example of model: public class Grupo { public int Id {get;set;} public string Nome {get;set;} public ICollection<Item> Itens {get;set:} } And the items public class Item { publit int Id…
-
2
votes0
answers1739
viewsHow to Develop a Remote Access
I would like to develop a system that could connect a machine to another machine and give me full control of this 2°machine, Ex: Team Viewer, Ammy Admin, Log me In. I would not like to do anything…
-
2
votes1
answer3248
viewsHow to verify if there is a certain ID in the database?
I’m validating before importing a file. csv to the database via C# , I have already done a validation to ensure that the state code is an integer and also need to check if there is the state code…
-
2
votes1
answer5336
viewsDetecting colors or geometric shapes of an image
Is there a framework for detecting colors or geometric shapes within a static image, such as a . jpg? Preferably for C# or java Hypothetical scenario: The framework would identify that there are 3…
-
2
votes2
answers9820
viewsCharacter string not recognized as valid datetime
protected void ButtonPesquisar_Click(object sender, EventArgs e) { var _macro = new LFSistemas.VLI.ACTWeb.Entities.Macro(); var macroController = new MacroController(); var itens =…
-
2
votes2
answers816
viewsConvert hexadecimal to integer
I have this hexadecimal value "E365A931A000000". I need to convert it to integer I’m using the following code. string hex = "E365A931A000000"; CodLibercao = Convert.ToInt32(hex); This code is…
-
2
votes1
answer240
viewsGeneric Locate Method, using ADO.NET and Procedures
I am looking for a solution from a generic repository to a DAL with a generic Find method, so there is no redundancy in my code. Using ADO.NET and Procedures. I found something in this link: What…
-
2
votes1
answer147
viewsAllow Multiple Providers with Authorize Attribute
I’m trying to implement permissioning by Roles within my controller: [PerfilFiltro(Roles = "Administrador,Caixa")] public ActionResult Index() { return View(db.Adicional.ToList()); } public class…
-
2
votes1
answer129
views -
2
votes4
answers3027
viewsLoading the values of a select in my Gridview
My DAL who does the Select and saved in the list type<> using System; using System.Data; using System.Collections.Generic; using System.Linq; using System.Web; using MySql.Data; using…
-
2
votes1
answer387
viewsWhat are Global.asax methods, when are they fired and good practices?
I would like to know what methods, when they are triggered and what is the best applicability (good practices) of them?
-
2
votes0
answers161
viewsMVC5 separate . Net Identity projects
I would like to create a solution where I have 3 projects obeying the following structure: The index of my site will be responsible for the registration of the user so that he has access to other…
-
2
votes1
answer273
viewsExchange Entity Framework EDMX for Code First
I have an EF5 application using EDMX modeling and I have much more experience and affinity with Code First. Does anyone have any idea/tutorial on how to migrate from EDMX to Code First without…
-
2
votes2
answers64
viewsWhy can’t I query for an added object before Savechanges?
I need to add several objects to the database and some objects need another specific object that I added earlier. When I make a query to get the object, it comes null. Example: var subItem = new…
-
2
votes2
answers1405
viewsHow to remove unused Resources?
Is there any way or extension of Visual Studio that makes it possible to search for unused Resources in the application?
-
2
votes1
answer94
viewsHow to register a default user at the beginning of the application?
In an ASP.Net MVC application I need to have a default user record and for that I am thinking of adding it on startup of the application. In the archive Global.asax I did the following: public class…
-
2
votes2
answers1135
viewsHow to publish a project in ASP.NET MVC at a specific URL
So I’m in a situation I don’t know how and I don’t even know if it’s possible to do. I have a website in ASP.NET MVC, let’s call it sitedokelvin.com.br, this site is an Asp.net mvc project. And I…
-
2
votes2
answers80
viewsHow to ensure that the instantiation of a class is done only through "using"?
I am creating a DLL with some database features (ADO.Net). It would be very convenient to ensure that instantiation of connections is always used only via using (block), not to forget to call the…
-
2
votes1
answer1511
viewsComposite primary key with entities in the Entity Framework
I need to make a composite primary key relation in the Entity framework using the entities themselves. public class ProjetoDocumento { public Projeto Projeto { get; set; } public Documento Documento…
-
2
votes1
answer187
viewsHow to create an Nxn relationship in the Identityrole class with a class created by me?
I have an automatic mapping of Controllers and its Actions running on application startup (file Global.asax). I use this to give permission to the user Controller x Action if he owns that…
-
2
votes1
answer63
viewsTrigger events remotely
What is the best way to trigger/receive an event remotely on C#? Example: When clicking a button on the PC1, perform certain task on the other PC’s that have the app. I thought of 3 solutions:…
-
2
votes1
answer158
viewsWhat is the correct way to declare the following class structure and get the respective Entityframework behavior?
I have the following class structure: public class Revenda { [InverseProperty("Revenda")] public virtual ICollection<UsuarioRevenda> Usuarios { get; set; } } public class Empresa {…
-
2
votes1
answer95
viewsReturns Excel in C# List is returning null
This code reads a file Excel and plays a list, the problem that is occurring is it is returning null, like there’s nothing in the Excel, but the column names are correct: string PathConn =…
-
2
votes1
answer314
viewsHow to add items from a IENUMERABLE in . Net MVC into a Jquery array?
How do I add items from a IEnumerable<T> in an array JavaScript? View: @using Colecao.ViewModels @model ConfiguracoesViewModel @foreach (var equipamento in @Model.Equipamentos) { //Gostaria de…
-
2
votes1
answer46
viewsEnable delete
I have my model which has several lists. For example: public class Funcionario { public ICollection<FuncionarioNotificacao> Notificacoes {get;set;} public ICollection<FuncionarioExame>…
-
2
votes1
answer135
viewsDate with bootstrap does not run in my project
I need to place a component to select dates in a filter in my project. As I use bootstrap, I need to place dates with this component. It turns out the examples I picked up on the internet, I…
-
2
votes1
answer128
viewsImplement Text Approval Flow
I am developing a project where the user can publish texts, but before being posted on the site needs to be approved, something similar to the invitations of friendship of social networks where it…
-
2
votes1
answer847
viewsHow to get the values of a list of inputs with the same ID by Webforms?
I have a list of inputs that are automatically generated by script and they are inserted in a form thus staying: <input type="text" id="txtValue" name="txtValue" /> <input type="text"…
-
2
votes1
answer7401
viewsOpen maximized form on full screen
I have a main form, which contains all the options of the system and I would like to know how to open this maximized on the full screen, if possible, adapting the different resolutions. IMAGE OF THE…
-
2
votes1
answer1887
viewsDownload txt file with ASP.NET Web Forms including HTML of the page in the file
I am downloading files with ASP.NET Web Forms at a Linkbutton click event as follows: var file = new FileInfo(filePath); Response.Clear(); Response.AddHeader("Content-Disposition", "attachment;…
-
2
votes2
answers743
viewsCommunicating a Windows Service project with a Windows Form project
I just developed a Windows Service project (this will be running to check for system updates, via Clickonce). I need this Windows Service to communicate with a Form. I know that it is not possible…
-
2
votes3
answers89
viewsHow to make several projects have the same post-compilation event?
I have a solution in Visual Studio with 277 projects. And I would like everyone to have the same post-compilation event. Basically, they would run an executable that is in the application folder.…
-
2
votes2
answers906
viewsLogoff with database registration and cookie deletion behind Session_end() in Global.asax
I need help with a project I’ve been racking my brain about for two days. I’m using Microsoft C# MVC5 technology and framework 4.5, I also use Entity Framework 6 with Repository Pattern, Unit of…
-
2
votes4
answers357
viewsObjectcache to provide a variable for all users
I have an application in ASP.NET and would like to cache for all users as if the variable was in pool application and everyone had access, something other than the session that makes the section…
-
2
votes1
answer109
viewsProperty containing only the Keyattribute attribute resulting in auto-increment column in the database
If I’m not mistaken, this must have come in version 6.1.1 of Entityframework and it wasn’t like this in previous versions. I believe a column only became auto-increment when the attribute…
-
2
votes1
answer1159
viewsSuggestion to update Windowsform application
I am developing a Windows Form application in C#, this is a slightly large application, I would like to know what technology I use to update this application on the client’s computer. I tried to…
-
2
votes1
answer276
viewsHow to style a WPF application to look like Windows 8 applications (Metro style)
I work in a company where they use a system that is very reminiscent of Windows 8, even though I am on Windows 7 machine. What I needed to do is to develop a desktop system on my computer (Windows…
-
2
votes1
answer379
viewsAdd N items to a Numericupdown-based Textbox
I created a program that generates passwords, but only generates one at a time. What I wanted was to be able to provide NumericUpDown so that the user could choose how many passwords or, which would…
-
2
votes1
answer119
viewsC# Threads How to optimize a SELECT with BLOB
I have an application in C# (.Net 4.5) that when loading a screen among other operations it looks for a background image and sounds in the database. It happens that for some screens loaded this…
-
2
votes2
answers818
viewsStore decimal value
I’m trying to take a typed point textbox value, and save it with decimal point, if you type 10.80, eh to store 10.8 in my variable. I tried it this way: decimal valorTotal =…
-
2
votes1
answer1822
viewsHow to debug ASP.NET or Webservices applications on IIS
I need to debug my application that consumes a Webservice and I would like to be able to debug Webservice in one Visual Studio window and the application in another, but I can’t make local…
-
2
votes1
answer228
viewsDifferentiate product from ingredient
I am trying to make a system for sale of açaí. In an açaí can add many ingredients like paçoca, milk powder, fruit and etc... Açaí can also be sold in 250ml, 500ml and 750ml pots. Depending on which…
-
2
votes1
answer803
viewsClick event. Display message in current form and open new form
I need to make the event click a button located on a form, open another modal form. While the other form is loaded, I need to display a message to the user in a Statuslabel of a Statusstrip. (an msg…
-
2
votes0
answers1008
viewsC# Agenda of Commitments
I need to make a schedule that will receive some appointments, and on the day of that appointment she will send a warning. Can someone show me some material, or path I need to start?
c#asked 9 years, 5 months ago Yuri Ancelmo 353 -
2
votes0
answers62
viewsStackoverflowexception for more than 50,000 values
The code sorts an array of up to 50,000 values from a txt and stored in a array for quicksort, but for 60,000 values or more, it’s Overflow. I’ve changed values to Int64 and persist... (Obs: I…
-
2
votes0
answers63
viewsWIA - Load network devices
I’m writing a C# code and using WIA to perform scanning tasks. However, I am having trouble capturing devices that are shared on the network. My code captures all devices that are connected directly…
c#asked 9 years, 5 months ago João Paulo Buback 21 -
2
votes1
answer1864
viewsHow to show "wait, load data" using asynchronous programming?
How can I use asynchronous programming with Async and Await so that it appears in the middle of the grid "Wait for loading data" while searching for data in the database and fill in with Datatable…
-
2
votes1
answer327
viewsAccess URL without receiving the reply
I have a page that performs several tasks. This page is open to end users of the system, who can access it via browser. In certain situations I would like to trigger page processing with a console…
-
2
votes1
answer260
viewsSystem.Outofmemoryexception - Parser for large files
I created a simple grammar to interpret a file whose format is much like a JSON. However, when I try to parse the file I get the exception Sytem.OutOfMemoryException. This is because of the file…