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
answer45
viewsJquery seems not to update
I have a Customer code = 3368. I made a function jquery that takes the code from Dropdown, which may be 1 or 3368 (only has two records there in the dropdown). It turns out that when I have in…
-
1
votes2
answers64
viewsLower and higher value within Objects with the same date
I have the following Json: { "cod": "200", "message": 0.0055, "cnt": 40, "list": [ { "dt": 1560319200, "main": { "temp": 15.15, "temp_min": 14.49, "temp_max": 15.15, "pressure": 1021.11,…
-
1
votes2
answers576
viewsFunction or Method to Restart an Application on the C#console
Is there any available function or method to Restart the application on the C console#? static void decision() { Console.WriteLine("\n Press the home key to recalculate. . .",…
c# visual-studio code-review main console-applicationasked 5 years, 5 months ago Gabriel Castilho 11 -
1
votes1
answer89
viewsAm I required to use a repeat loop if my LINQ query returns only one object?
My class: public class Carros { public int ID { get; private set; } public string Atributo2 { get; private set; } public int Atributo3 { get; private set; }}} Suppose the ID attribute could not…
-
1
votes1
answer100
viewsError while trying to render a partial view in a view
I have a View(cshtml) and I need to call a partialView. This Partial is a table with the logs of that Sale, which will be viewed in tabular format at the bottom of the View. The problem is that when…
-
1
votes1
answer70
viewsMonitoring the last Row from a table
I’m trying to monitor the latest row bank MySQL and when this is changed I will display a message, however I am having doubts on how to monitor with C code#. I’ve managed to requisition the last row…
-
1
votes1
answer65
views -
1
votes1
answer54
viewsHow to use Join or Aggregate in SQL query
When performing the query in a given table, numOrc is a list that may contain one or more values. So I needed to concatenate these values into one string, using ; as a limiter. So I tried: var model…
-
1
votes1
answer21
viewsProblem with Binding and Caretindex
I have a Datagrid List: <DataGrid Name="GridLista" Grid.ColumnSpan="20" Margin="5" Grid.RowSpan="17" Grid.Row="3" CanUserAddRows="False" CanUserReorderColumns="True" AutoGenerateColumns="False"…
-
1
votes1
answer57
viewsProblems creating Postgre backup on Asp.Net MVC
I didn’t find much information about creating Postgre backups with C#, so I created this post. The process is simple... I am creating a process that executes a command and passes some parameters…
-
1
votes0
answers133
viewsRestsharp taking his time making the first requisition
I am making an application using Xamarin Native and I decided to use Restsharp to make the requests to my API, the problem is that the first request made takes a few seconds (some 3) to be made,…
-
1
votes1
answer85
viewsJoin C# EF6 lambda Expression
I’m having a problem, I’m doing a Join with C# with EF6, I have two unrelated tables Invest and Encarteiramento and need to make a Join in Invest where agency and account is equal to, agency and…
-
1
votes1
answer108
viewsDisplay <list> in Datagrid with 2 different classes c#
I have two classes PET and CUSTOMER(Inherits from PERSON) ` private int codPet; private string nome; private string especie; private string raca; private string porte; private string sexo; private…
c#asked 5 years, 5 months ago Isa Borges 31 -
1
votes1
answer236
viewsForeach in a Viewbag is not working properly
Inside that foreach @foreach (var item in Model) { <tr> <td> <h3 id="subscription-@(item.SubscriptionId)" data-id="@item.SubscriptionId" class="item-accordion result-header">…
-
1
votes1
answer133
viewsProblem downloading a file with an accented name
I have a function that returns a file to download, when the file name has accented characters and a certain size, the downloaded file comes with the wrong name (in Chrome comes the name of my…
-
1
votes1
answer52
viewsAdd message in Oauth reply
I created a web api with token validation that works correctly, my problem is: I would like to put a message after the mandatory information, I leave attached an example image(I would like to add…
-
1
votes1
answer108
viewsHow to convert Enum to int by filling with zero on the left?
Ladies and gentlemen, I have a question here of converting a enum in a string, but I need the conversion to be filled with zero to keep 2 digits. Example public enum System { Unknown = 0, Mirror =…
-
1
votes1
answer147
viewsSubquery with entityframework lambda
I have this select which on the basis of it was made in the entity framework select PedidoVenda.Id, Funcionarios.Nome, FaturaContasReceber.FaturaContasReceberPId, FaturaContasReceberP.TotalFatura,…
-
1
votes1
answer215
viewsHow to access Ihostingenvironment outside of the Controller in ASP.NET Core?
I’m updating an ASP.NET Framework API to ASP.NET Core and I’m stuck in a problem. No. NET Framework used the following: public GmailConnection(){ serverCredentialPath =…
-
1
votes2
answers99
viewsWhy doesn’t my variable change the value?
I have several variables and one of them is menor, when checking her out (output) I realized that the same always remains at zero, because this is occurring? int z, menor = 0, maior = 0; for (int i…
-
1
votes2
answers1018
viewsApi Climatempo C#
Good afternoon, I am making a web application for college where I need to consume a C#Climatempo API, in my code, I am passing as parameter the code of the city and making the request for the:…
-
1
votes2
answers248
viewsError while trying to connect to another Rabbitmq server
I am trying to send a message to another machine in my network that already has the rabbitmq installed. The following error occurs: Error message: None of the specified endpoints Were Reachable When…
-
1
votes1
answer44
viewsC# Conversion Error when trying to save to SQL Server database
I’m new to C# and I’m taking a beating to record texbox data in SQL Server private void Btn_salvar_Click(object sender, EventArgs e) { using (SqlConnection con = new SqlConnection(strConexao)) {…
-
1
votes1
answer299
viewsChange float field to decimal
I have a field, which in the model was like float, and that’s how you got saved, and you already have data in those columns. But what happens is that now I need 6 decimal places after the comma.…
-
1
votes1
answer60
viewsHow to generate and download excel from a large volume of data in ASP.Net MVC?
Hello I have web application that provides a download of contents of the database in excel format, I am using in my controller a method of type Fileresult. Below abridged version of the code. Simple…
-
1
votes1
answer384
viewsThere is no mapping of the System.Windows.Forms.Toolstriptextbox object type to a native type managed provider
I’m having a problem trying to make an appointment at a Select and bring the information on TextBox. There is no mapping of the System.Windows.Forms.Toolstriptextbox object type to a native type…
-
1
votes1
answer119
viewsConvert Iqueryable to a type
I made that code OrderItem itens = new OrderItem(); var items = _orderService.GetItemsFromOrder(orderId); itens = items.Where(x => x.CurrencyCode == 23).Select(s => new OrderItem { ProductId =…
-
1
votes2
answers121
viewsHow to verify that the executable has been changed? C#
Someone could help me, I’m trying to check if the execultavel was renamed, like Demo.exe (has to be like this always) if change it give error The Archive must have the name 'Demo'. and not allow…
c#asked 5 years, 4 months ago Rodrigo Pretti Fantin 59 -
1
votes1
answer40
viewsHow do I pull the CAPTCHA Poup with Javascript into my form in my ERP management system?
The http://www.sintegra.gov.br/ is a government website with public information about companies. When accessing the site I need to inform the CNPJ, select the UF of the CNPJ and fill the CAPTCHA...…
-
1
votes1
answer93
viewsHow to control MDI forms through a general method?
I am developing a system with MDI forms. I have a menu that is the MdiParent and everyone else is allocated as your children. Originally, MDI allowed me to open the same form several times; then I…
-
1
votes3
answers1381
viewsHow to declare an object parameter as null in C#
I have the following class in C# namespace Projeto.Models { public class Biblioteca { public int Id {get; set;} public string Nome {get; set;} public Livro Livro {get; set;} } public class Livro {…
-
1
votes1
answer76
viewsCreate a configuration ". TXT" file
My problem is this, I need to make a configurable file to integrate to my project, follow its format currently: PRINTER = 127.0.0.12 PRINTER_PORT = 9100 I’d like to format it for this style:…
-
1
votes0
answers118
viewsdatepicker calendar opens and closes when you click the form Submit button
Hello. I got a problem here. I have an aspnet mvc form with c# that has two datepicker: <form id="formBuscar" action="PaginaDeDeAcertosDaQuestao" class="form-horizontal box3">…
-
1
votes0
answers107
viewsFailed to save user fields in sales editor
When the article is identified it makes all the changes below that it has to do. When I save the Sales Document it does not correctly save the changes to the document, when I load the document later…
-
1
votes1
answer81
viewsReturn lambda value and not lambda mounted query
I did that lambda OfferUri = OfferUri.Select(s => s.Items.Where(a => a.SubscriptionId == s.Id).Select(n => n.Id).FirstOrDefault()).ToString() and when I see what she returns to me, I have…
-
1
votes1
answer46
viewsUpdate main form after closing the load form
What I’m trying to do is, I need to open another form in another thread where there is a Progress bar that is indeterminated, and in the main ui I need to update the datagrid with the data from the…
-
1
votes0
answers63
viewsEven with ". Asnotracking" error happens "cannot be tracked because Another instance with the same key value"
public class ProcessoOsOperacaoEntity { public int? Id {get; set; } public int? IdProcessoOs { get; set; } public virtual ProcessoOsEntity ProcessoOs { get; set; } public int? IdUsuario { get; set;…
-
1
votes0
answers42
views.Crystal Report setdatasouce() giving Nullreferenceexception error
Hello. I am making a simple test report using Crystal Report with c#. The report is loaded by a . ttx file; On the controller I put: public ActionResult ObterRelatorio() { try { byte[] relatorio =…
-
1
votes2
answers340
viewsHow to communicate with SOAP webservice
I am trying to communicate with a SOAP Webservice. I was able to communicate using SOAPUI as image: I am developing this communication in c# as follows: try { var service = new…
-
1
votes0
answers241
viewsAn error occurred while sending the request
I am generating a batch xml of rps, and to envelop, and add ![CDATA[ he jumps line, I thought it was something with the registers, but I managed lot of only one rps, one by one, to see if it would…
-
1
votes1
answer213
viewsHow to ignore a Serialization?
I’m having trouble serializing a Socket class with BinaryFormatter, tried to use the attribute NonSerializedAttribute, but it just doesn’t work for this kind of property below.…
-
1
votes0
answers48
viewsHttpwebrequest error
I’m using this code below to send a xml to the webservice from city hall, the maximum RPS you send is 40. What happens is that I already sent with 40 and did not get problems earlier. It is…
-
1
votes0
answers40
viewsGet a company record
I am new in c#, I would like help to pick up and registered company by user X, what I need is the function Businessman Functioncontroller public async Task<IActionResult> Create() {…
-
1
votes1
answer64
viewsHow to return the numeric value of a Selectlistitem C#
I need to return a List Selectlistitem where the value property of each item returns the value of Enum (1, 2...) and not the name of the property (physical, juridical...). How do I do that? Function…
-
1
votes1
answer40
viewsrefer to the logged in user’s id if missing
I’m doing a Net Core MVC point card project, in which I have user, company and employee registration. To register the company I need to get the id of the logged in user, I already have a function…
-
1
votes0
answers273
viewsSave cookies to Selenium
I’m developing an automation in Selenium C# to log in to Facebook and do some operations, but every login asks me to account verification. There is a way you can save authentications as a common…
-
1
votes0
answers58
viewsHow to pass a view ID without a template
I’m trying to send a template-less view ID to a controller, but I’m not getting it. the code I have is as follows: View @model string @{ ViewBag.Title = "Edit"; string classHtml = ""; } @using…
-
1
votes1
answer175
viewsHow to leave field with bold values
Situation I have a table made in html called Payments and in it I have a column called values, I want to leave the fields with values in bold. Problem: There are collaborators who had value to be…
-
1
votes1
answer206
viewsChanging Database of a system that is using EF code first
Please, I need to change the BD of an application using Mysql to use MS SQL Server. I have already migrated tables, data and relationships. The problem is that the system was made, I believe, in the…
-
1
votes1
answer103
viewsWhy does the model return null after using Automapper?
To model Endereco returns null after mapping (Automapper), why ? Example: using AutoMapper; using System; using System.Collections.Generic; using System.Linq; using System.Text; using…