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
-
1
votes1
answer317
viewsInstances of Singleton Asp.Net Core classes
I have a doubt in the following situation: Singleton Classe namespace TesteSingleton { public class Singleton { private Singleton _singleton; public Singleton() { if (_singleton == null) _singleton…
-
1
votes1
answer161
viewsButton pause music player
I’m a programming intern and I’ve decided to do something I’ve never tried before, a music player. I am building the functions that each button should do but I noticed that I made a mistake in the…
c#asked 5 years, 7 months ago Juan Veras 13 -
1
votes0
answers48
viewsUpload file to Asp.net core by fetch
I’m editing the previous question. This function traverses a table with input file and plays in a formData but sent by fetch at the asp.net core is coming null function uploadFiles() { let…
-
1
votes1
answer52
viewsPassing parameter between layers
I’m starting in the c# language and I’m having a problem crossing parameters between layers. In my program I made 3 layers, the Dal, Model and the interface. When I try to compare a return value of…
c#asked 5 years, 7 months ago Nicolas Vieira 11 -
1
votes1
answer172
viewsConsume the Security of an API for MVC Web Application
I have an API to log (Aspnet Identity) into the WEB MVC application. Access to WEB MVC application(Login Screen). I call the API by passing email and password, which was informed in the WEB MVC…
-
1
votes1
answer71
viewsError connecting to database (mysql) using entityFramework
When trying to connect in the database I get this message: The underlying Provider failed on Connectionstring. <entityFramework> <defaultConnectionFactory…
-
1
votes1
answer19
viewsHow and where to validate form controls that match the fields in my database?
I have the following problem: I need to validate my controls (textbox, combobox, etc) that correspond to the fields of my table, for example, on my screen I have the txtBairro control, in which the…
-
1
votes0
answers97
viewsException from HRESULT: 0x800A03EC
Error executing the following lines of code: Result res = new Result(); foreach (Process clsProcess in Process.GetProcesses()) { if (clsProcess.ProcessName.Equals("Microsoft Excel (32 bit)") ||…
-
1
votes2
answers174
viewsCombine TIFF files in C#
I’m trying to combine multiple TIFF files into a multipage. I am used Magick.NET but the end result is a TIFF with only the first page. I tested with a 10-page file but only got one. I think there…
-
1
votes1
answer83
viewsList for logical deletion
I have a question about who’s responsible (back or front) in my case, I have a list on front which is sent to the backend save or inactivate the record: [{ idTabela: 2, codKit: "kitCopleto",…
-
1
votes1
answer170
viewsOptimize query. The foreach is too slow
I have this query [Route("")] [HttpGet] [ResponseType(typeof(List<MarkupListResponse>))] public IHttpActionResult Get(int resellerId) { var catalogs =…
-
1
votes0
answers165
viewsLINQ return with repeated values
I’m having trouble with a consultation within my application. The values returned by my query are repeated, the same value appears 407 times, when the right one would have to be 407 different…
-
1
votes1
answer275
viewsFind(ID) of Mongo returns nothing
I have a collection called users on Mongo with approximately 1000 values. Access Mongo through Mongodb . NET Driver, at the moment everything works normally. But these past few days I’ve been…
-
1
votes1
answer37
viewsError: Unrecognized escape Quence
I am developing a program in c# to read files. xlsx and it is giving error in the path "path" on line 9 of that file and I don’t know why. static void Main(string[] args) { static…
-
1
votes1
answer107
viewsEdit Activedirectory user with C#
Hello, I am trying to add the initials of the company’s employees in the initial parameter of the AD user and when trying to run it returns me the following message:…
-
1
votes4
answers243
viewsProblems saving an already edited entity in the Entity framework core context
Hello I’m working with Asp net core my project follows DDD architecture, I’m having error with Entity Frameworks Core, when saving an altered entity, ie I load it in the frontend I change a property…
-
1
votes0
answers109
viewsTAD Alphabetical Order Method List
This is the first topic I’m posting, I’d like you to help me with this problem. The problem is based on ordering data entered in a Dynamic List (C#) according to name (Alphabetical order). As it is…
-
1
votes0
answers16
viewsError filling Crystal Subreport source date
I am creating a c# report using SAP Crystal Reports, my report contains a subReport when I view the report by Visual Studio in the report edit mode it fills the data in the normal subReport, however…
-
1
votes1
answer281
viewsSwagger Json in Postman does not put the API URL
I am using the Swagger library on . NET CORE in a Web API to generate the documentation, below is my startup.Cs: public class Startup { public Startup(IConfiguration configuration) { Configuration =…
-
1
votes1
answer180
viewsMake Distinct Entity Framework
I’m trying to accomplish the Distinct, in my model of Phones, but none of the options I’m trying to make work. Could tell me what I’m doing wrong ? Below I described several ways I have tried to do,…
-
1
votes2
answers674
viewsHow to send WS XML file from Safe Harbour (made in PHP) using Restsharp C#
I am trying to integrate a Ct-e XML file with the Safe Harbor Web Service (done in PHP) using Restsharp in C# and always returns message saying that they could not open XML or that file is empty.…
-
1
votes2
answers95
viewsProblem with LINQ
I am converting PDF to TIFF and converting page by page to a temporary folder and at the end I will fetch those files to join them as in the original file. My code is as follows: (I used what is in…
-
1
votes0
answers25
viewsInteracting with images
Talk guys.. I’m new in the area, but I’m looking to study a lot.. I started with java, I already did a lot of "things", small business automation software and Talz.. however, I wanted to make a new…
-
1
votes1
answer307
viewsWebbrowser does not load css c#
I tried to create a Simple browser and when I finished I realized that it does not carry css the site gets horrible looks like a website outdated. :\ Can someone help me? Photos from the site, if…
-
1
votes2
answers90
viewsProblem with database query by date using Line and Entity in C#
I have the following appointment at the bank; consultas = ctx.Consultas.Include(c => c.Cliente).Include(p => p.Procedimento).ToList(); which works perfectly, but I want to include a Where to…
-
1
votes2
answers2655
viewsBeginner : C# recursive function
help for Recursive Function that prints the average of the elements of an integer list and the number of elements larger than the average. in c# good, what I have so far, is giving…
-
1
votes0
answers248
viewsHow to upload a file to the server - Asp . net MVC
Good afternoon, I did a small project on Asp . net whose only goal is to select a file on my computer and save it on the server. The problem is that I am unable to perform this procedure after…
-
1
votes0
answers124
viewsError validating if the selected datagridView Index is null
I’m having difficulty feeding a dataGridView with objects, where I need to list properties of another object. as for example: PRODUCT.CODE, PRODUCT.DESCRIPTION, REQUEST.VALUESARY. The only solution…
-
1
votes0
answers178
viewsSelenium with Chrome Headless fails to get URL
In my test script I simulate the click on a button, which generates and opens a PDF in a new Chrome tab. //Imprime consulta IWebElement btnGeraPDF = driver.FindElement(By.Id("id"));…
-
1
votes2
answers151
viewshelp not to repeat the same case of a switch inside a for (c#)
I am in the first period of an SI course and I need to play a truce and I came across a situation that I am not able to solve. I need that during the loop I can not repeat the same case in the truco…
c#asked 5 years, 6 months ago Jonathan Paiva 13 -
1
votes1
answer40
viewsError system.net.webexception: 0 using the Ibmwiotp library
I’m working with the library Ibmwiotp to make a POST equipment on the IBM Watson Iot Platform. I have the following code: public void AddDevice(){ try{ ApiClient client = new…
-
1
votes0
answers38
viewsError running Oracledatareader.Hasrows with cursor without values
I am using Oracledatareader to insert elements of a cursor into a list. The cursor is returned from an oracle db procedure. The problem is that when I have no elements returned on the cursor, the…
-
1
votes0
answers49
viewsLegacy application repository standard - ASP.NET MVC 5
I am participating in a project using ASP.NET MVC 5, I would like opinions to form a concept in which I can achieve good results with a good team productivity. What I have of interfaces: Irepository…
-
1
votes2
answers128
viewsSession variable always returns Null Asp.Net
Business Class: public class Empresa { public long empresaId { get; set; } public string nomeEmpresa { get; set; } [Display(Name = "login")] [Required(ErrorMessage = "Informe Seu Login",…
-
1
votes0
answers86
viewsProblems with music in Windows Forms in C#
I am doing a job for college with Object Orientation and Windows Forms, but I have the following problem: The program consists of several Forms, in the first I made the code to play music as shown…
-
1
votes0
answers54
viewsJsonserializationexception, Error converting JSON
I am trying to deserialize an object brought by my webApi, tested with other objects and works, but with this no The error is as follows: Jsonserializationexception: Unexpected JSON token when…
-
1
votes3
answers210
viewsclear field if only html tags exist in text field
I have a text field that allows html codes. When the field is empty the tags are passed <p><br></p> below the screens, if I give several enter in the field below the cloths is…
-
1
votes3
answers194
viewsTake what’s between the quotes
As I do to get only what is inside double quotes, the problem is the following, it is reading a file txt q on each line has a file path, as this below "Dinosfuls Mods.bmd" 45454545s 454545 How do I…
-
1
votes0
answers102
viewsEdit a txt file c#
This code below is a configuration file .ini As I do to read the X line and edit 0 or 1, in the app I did everything as checkbox, if check = 1 if false = 0, however, I do not know how to read these…
c#asked 5 years, 6 months ago Rodrigo Pretti Fantin 59 -
1
votes1
answer108
viewsHow to check if client disconnected abruptly
I have this online chat code using socket and TCPListener, but when the client simply disconnects abruptly or loses connection, it is not removed from the ArrayList so-called clients. public void…
-
1
votes2
answers45
viewsPlan properties in a single table
Consider the following classes: public class Pessoa { public int Id { get; set; } public string Nome { get; set; } public Telefone Telefone { get; set; } } public class Telefone { public string…
-
1
votes1
answer347
viewseSocialBX: Error 402 - "Invalid request"
I’m trying to consume the web service Query to Event Identifiers, but I get this return: <?xml version="1.0"?> <eSocial…
-
1
votes1
answer74
viewsError while trying to update inside a foreach
I have this foreach private void UpdateAzureDiscountGroupReseller(IQueryable<Reseller> model) { Reseller resellerObj = new Reseller(); foreach (var item in model) {…
-
1
votes1
answer76
viewsHow to select standard words using Regex?
I want to validate this regex: - regex.test.test.test.test - -regex.test.test.test.test - +regex.test.test.test.test If you take a trace from the beginning to the word, I want this regex to be…
-
1
votes2
answers33
viewsHiddenfield value always zero
Good morning, I am learning Asp.net and I came across a problem in my code that I do not know how to solve. I have a gridview that is fed by the database and I have a button that calls the…
-
1
votes2
answers101
viewsWhat reason does the "missing()" at the end of the program send me an error in which it is not possible to compile?
Main Nota estudante = new Nota(); estudante.Matricula = Console.ReadLine(); estudante.Nome = Console.ReadLine(); estudante.Idade = int.Parse(Console.ReadLine()); estudante.Prova1 =…
-
1
votes1
answer164
viewsInjection error of dependency
I’m using Xunit to carry out my tests, I am trying to access my CampeonatosController, consequently I have to pass the value shown in the image below as parameter, but I am getting the error below.…
-
1
votes1
answer198
viewsAssembley resolve is not called in a console application
Hello. I have a console application that runs in a different folder than the folder where the ERP PRIMAVERA core assemblies I need to use are located. The problem is that when you run my…
c#asked 5 years, 5 months ago Sérgio Sereno 1,008 -
1
votes0
answers72
viewsInserting data into two tables in a single form
Hello, good morning, good morning! I am studying Webform in college, and I have a question to enter a value of a single form page for two Tables. In case to exemplify, I have two tables "Person" and…
-
1
votes1
answer369
viewsDeserializeobject
I’m trying to use the DeserializeObject, to generate objects through the result json: { "cod": "200", "message": 0.0068, "cnt": 40, "list": [ { "dt": 1560286800, "main": { "temp": 17.14, "temp_min":…