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
answer223
viewsHow to run a MERGE object list by returning the Update or Insert Id?
I have the following scenario; I need to make a INSERT or UPDATE from a list of List<PRD_ARTIGO_VARIANTE_VALOR>, my doubt is whether there’s any way I can get past the list of a single time by…
-
1
votes2
answers248
viewsVisual Studio - Managing Locally Registered Dll Publication of Homologation and Production Environment
I am working with a Dll from Itaú bank(itauCripto.dll), the documentation requires it to be registered locally on the machine running the application. So I put the Dll inside the folder %systemroot%…
-
1
votes1
answer76
viewsConcatenate two variables into one using LINQ
Through LINQ I make a query in the database in the fields CPF and CNPJ table People and need to assign these two table fields to a single variable Document to display on screen. According to the…
-
1
votes1
answer56
viewsOne-To-One relationship with EF?
I’m trying to create a relationship OneToOne with EF6. In my scheme I have a User class and a Plan and the relationship would be 1 User has 1 Plan, however, this relationship is done when the User…
-
1
votes1
answer270
viewsHow to set up a certificate to make a connection to Javascript Websockets
How to configure a certificate to make a connection with Javascript Websockets, using c’s Superwebsocket server#? I need to create a websocket connection on an https page, the only way is using…
-
1
votes0
answers21
viewsHow to Convert a String to a Date in C#
I am trying to build a method that takes 4 parameters: "name" which will be a text, "data_birth" which will be a date, "profession" which will be a text and "numero_calcado" which will be an…
c#asked 4 years, 10 months ago Anakin_Skywalker 11 -
1
votes1
answer32
viewsThe same variable is used by different methods, but the second does not take the information captured by the first
Beginner question you are picking to learn. Next: I have a variable "taxaDI". I capture this information by the Capturrtaxadi method(). Then, this value must be inserted into a database by…
c#asked 4 years, 10 months ago Marcos Carvalho 1 -
1
votes4
answers491
viewsPrint values of a vector without line break
Hello, I’m performing a C# exercise that asks for the following: The output with even numbers should be presented without line break, but I do not understand how I can do this. My code is like this:…
-
1
votes1
answer77
viewsSystem.Typeloadexception
I’m most likely not able to connect my application to my database with Entity Framework Core, as this error keeps popping up whose I can’t decipher. I have already researched the documentation and…
-
1
votes3
answers1361
viewsC# Manipulate Postasync Response
I have the following code: string json = new JavaScriptSerializer().Serialize(new { email = textBoxLogin.Text, password = textBoxSenha.Text }); using (var client = new HttpClient()) { var response =…
-
1
votes0
answers185
viewsHow to insert an input type file with validation in a Blazor form (Editform)
I’m following the official documentation ASP.NET Core Blazor Forms and Validation at this link Blazor form with validation and I realized that some inputs are missing, being these: input…
-
1
votes1
answer136
viewsEntity Framework Core relationship creation one to Many
public class Evento { public int Id { get; set; } public string Nome { get; set; } public Categoria Categoria { get; set; } public CasaShow CasaShow { get; set; } public float QuantDeIngressos {…
-
1
votes0
answers163
viewscheck if the name already exists in the firebase and c#
I have not been able to find any results for my question and I will try here. So, I have a firebase database in a c# application and I was wondering if it was possible to check if the name entered…
-
1
votes0
answers150
viewsProblem consumption Webservice NFS-e
I am having several problems in the consumption of the webservice of Joinville, SC. Homologation: https://nfemwshomologacao.joinville.sc.gov.br/NotaFiscal/Servicos.asmx?wsdl Production:…
-
1
votes1
answer118
viewsHow to add a column with text in gridview by code Behind?
I make a SELECT in the bank and mount my gridview, after that I make another SELECT and needed to add an extra column with the values that came. I have a Foreach to go through all the lines of the…
-
1
votes0
answers269
viewsHow to read variables from ASP.Net Core Multiple Environments?
I’m trying to read from the properties appsettings file with different values, one for each environment. My files are as follows, appsettings.json, appsettings.Development.json,…
-
1
votes0
answers135
viewsDate value coming 01/01/0001.00:00:00
I’m having a problem with my API when I try to rescue a date from a column in my table in Sqlserver I’m doing it this way using (SqlCommand command = new SqlCommand()) { command.Connection =…
-
1
votes0
answers71
viewsRegex.Unescape() does not work
My project has a class with the type property string which receives the XML of a Tax Note signed by SEFAZ. The system must send the property as a parameter to a WebService that only returns an…
-
1
votes0
answers32
viewsInsert record Many-to-Many - EF Core
Problem: Error overflow when trying to create record in table with relationships. Error when I pass the virtual members with their type instance: The bank returns saying it cannot find the key…
-
1
votes1
answer52
viewsAsynchronous Function in C# Web
I am making a web page that does a database search and using in only one machine everything is normal, however, when the search is used more than once, as for example, in two different machines, the…
c#asked 4 years, 8 months ago Bruno Miqueas 127 -
1
votes0
answers125
viewsUnion All for Entity framework using Lambda
I’m having problems in a query using lambda and Entity Framework in C#. When transforming a simple sql query into lambda works perfectly, as example below. SQL query public DataSet ListarRecebidos()…
-
1
votes1
answer54
viewsUse a form int variable in another form C#
I have been trying to use my Form1 double money variable in form2, because I need the amount received in Form1 in form2, I left the publish variable and tried to instantiate but still giving error:…
-
1
votes1
answer73
viewsIn a banking scenario with high transaction volume Code First can be higher than Database First or vice versa?
I am architecting the development of a backend structure composed of microservices for a financial institution. Probably the biggest project I’ve ever worked on, and I’m having serious doubts about…
-
1
votes0
answers41
viewsButton to insert entries into the BD
I am conducting a project for my PEF that consists of creating a Company Database. However, I decided to put a button to add records and when I click to add, the following error appears: Failed to…
-
1
votes1
answer89
viewsConsole input is not treated correctly
When compiling my code in Visual Studio Professional 2019, it is giving error, for example: Digite sua idade : 12 Você é adulto Code: using System; //Usa A Biblioteca System public class Idade {…
-
1
votes1
answer54
viewsOperation of the "Contains() method"
I have a array of strings: string[] warnings = { "INQUIRY REQUEST", "ITEM ALREADY EXISTS", "ITEM NOT FOUND", "END OF FILE", }; and I have a variable with the following value: status = " 18:46:24:97…
-
1
votes0
answers35
viewsPerforming Groupby with Linq?
I’m trying to perform a Groupby but I’m not getting it. Always returns an Exception that I’m not able to solve. How do I solve this problem ? LINQ public ActionResult MeusConcursos(){ Usuario…
-
1
votes0
answers116
viewshow to save value of a c# variable to an external file?
How can I save a variable to an external file? It was programmed in win Forms . Net Framework c#. For example: In the following we have that whenever I press the ADD button to combobox, currently…
-
1
votes1
answer39
viewsList of objects generating string
I have an object list Person that contains a list of Endereços. I would like to print this person with the addresses on string. var pessoa = new Pessoa() { Nome = "Jão" }; var e = new Endereco() {…
-
1
votes0
answers41
viewsIs it possible to associate one TCP Socket to another already connected and send data through it?
When I use socket.Accept() I get a connected Socket, using the option socket.ExclusiveAddressUse = false it is possible to associate (Bind) another Socket to EndPoint. But when I use the function…
-
1
votes1
answer119
viewsGet public site user IP
Good evening, everyone I made a web application with ASPNET and C#, and I need to get the user’s IP when he accesses the system. I researched if I found several ways, but I always have this…
-
1
votes2
answers80
viewsC# - Loop no while
I have a C# function that checks if a download has been completed by referring to whether the file exists .crdownload is true. If this does not exist, I assign a true boolean to the while variable,…
-
1
votes0
answers153
viewsDirect Print PDF C#
Hi, I need some solution to print directly to the printer a pdf, without opening dialog boxes and without using adobe, the pdf was generated with the pdfsharp library, I can even use libraries but…
-
1
votes2
answers109
viewsAccess a Form method to another Form
I have a Method carregarLista() on form calling Funcionarios, and would like to access this method from another Form called Cancelar. The method is published in Form Funcionarios, I just can’t…
-
1
votes0
answers67
viewsimage and write to the sql database in the image field
Good afternoon. I have a little problem with my code, and I need some help. I am inserting an image in my form in an image field, now I need to take this image and write an image field in a field in…
-
1
votes2
answers112
viewsGenerating a txt with random numbers repeats the numbers
The program has to generate 10 letters and then skip a line with 10 different letters. I used the Random() and I was able to generate 10 random letters, only then just the lines repeat. Like, it…
-
1
votes1
answer341
viewsHow to remove space from the JSON (String) value in C#?
I have the following JSON stored in a String variable: {"novosPedidos":[],"pedidos":[{"Apagar":" 633.56"}]} The "Delete" value contains a space which I need to remove. I tried using the Replace()…
-
1
votes1
answer89
viewsMethod overload in C#
I am learning about overload methods in C# and would like to create a simple program that reads a user’s age and name, but would like to create two methods with the same name (overload) where…
-
1
votes0
answers15
viewsHow to correctly implement a System.Threading.Monitor in . net core
I have a piece of code that implements a Monitor. The purpose of this code is not to allow another thread to write in the log while one of them is running. This code works perfectly in . net…
-
1
votes0
answers72
viewsHow to release memory in a WPF application in C#?
Well I created a system in WPF and C# and every day that passes it gets bigger, I honestly had never worried about the issue of memory for small applications doesn’t make much difference, but that’s…
-
1
votes0
answers27
viewsI need to put an ID in the print file using C# and Itextsharp
Edit: if anyone has the same problem as me, I solved by playing the " Pdfptable ID = new Pdfptable(1)" out to be a global var and put the "pdfdoc.add(ID)" part out of the while So, for my work, I…
-
1
votes0
answers82
viewsHow can I make a program open a saved file on the computer without this program running?
Hello! I would like to share a question that I am having in a program that I am developing of the Windows Application type in C#. This is a notepad for my personal use. The operation of this…
-
1
votes1
answer109
viewsC# Function convert string to xml
I wonder how to convert a string with XML inline for a XML with tags, I’m using the XmlDocument, I have the following code: var MihaString="<MeuXML Info01="teste 0121245" Info02="2020-01-14"…
-
1
votes1
answer57
viewsInconsistent Accessibility: "Teacher" parameter type is less accessible than "Professor.Insert(Teacher)"
What do I do to fix this error? It turns red underneath the methods created in this code. And when I pass the mouse shows: Inconsistent Accessibility: "Teacher" parameter type is less accessible…
-
1
votes1
answer60
viewsBest option to store (key, key and value) in C#?
I am working on a tool where the user inserts information and based on some calculations in the entered value it returns a fixed value description. Example: User enters the value 101. It value will…
-
1
votes1
answer242
viewsChange SDK version 3.1 to 2.1
I made all my ASPNET Core API 3.1 but when I went to configure the CICD, Nuget Restore accuses version error... Speaking I have to use a version 2.1 or lower. (error to follow) '##[error]The nuget…
-
1
votes0
answers213
viewsCielo’s integration with C# and Asp.Net MVC?
I’m trying to integrate Cielo to make payments on my site "Asp.Net MVC" but I’m not getting it. I read the Cielo integration manual, followed all the steps, performed tests in Postman and works…
-
1
votes1
answer32
viewsAdding 2 rows of fields in a Database using C# (MVC)
I am doing an Actionresult within a control to effect some purchase data. The idea is to buy and sell products (in this case Coins),negativando a Quantidade and positive Valor in case of sale and…
-
1
votes1
answer237
viewsHow to insert values that have "," as decimal separator?
Hello, I am making a product registration using . Net Core 3.1 and I have the following problem: In the product register there is a field to insert the value of the product, however when inserting a…
-
1
votes1
answer61
viewsIs it possible to have more than one "post" route in a controller. NET?
I’m starting a C#. NET Core API project. When I create a controller like "API Controller with read/write actions" it creates the available actions. using System; using System.Collections.Generic;…