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
answer64
viewsError in API POST when inserting object
Hello, I am trying to add an object to the database by calling my API and I get this error: ORA-00932: inconsistent datatypes: expected NUMBER got NCLOB I just wanted some help with directing,…
-
2
votes1
answer819
viewsCannot Create an instance of the Abstract class on interface 'Httprequest'
I’m getting the following error: Cannot Create an instance of the Abstract class on interface 'Httprequest' In that part of my code: class FakeContext { public static HttpContext FakeHttpContext() {…
-
2
votes1
answer95
viewsObject does not recognize member
All I do is in Python. One of the functions I have to do is a conversion, where she tries to convert the value of TextBox and if it goes wrong, run the error block. private void converter(object…
-
2
votes1
answer234
viewsHow to fill a Datagridview manually, after having used "Tolist()" from the link as Datasource?
I am filling the Datasource of my Datagridview so: var enderecos = from endereco in EnderecoBusiness.Enderecos select new { Logradouro = endereco.Logradouro, Numero = endereco.Numero, Cidade =…
-
2
votes1
answer65
viewsCatching errors in Messagehandler
Hello I am trying to deal with errors in my application by making use of DelegatingHandler. But I have a problem, I used a try-catch to deal with errors. The try-catch encompasses the SendAsync,…
-
2
votes1
answer265
viewsCompute square root with input from typed text
I’m not getting the calculator to take the root of a number that the user types. The most I got was what is in the code, but regardless of the screen value, it only returns the root value of 2…
-
2
votes1
answer177
viewsHow to put a char variable in a string through the keys { }?
I’m doing an old-fashioned game, where there’s a function that prints it, and another that contains the 9 playable positions, I simplified the code so it doesn’t get too big and I just put a…
-
2
votes1
answer2713
viewsThe index was out of range. It should be non-negative and smaller than the collection size
I am creating a program that stores the profiles of all teachers online currently in a list and then displays the first 3 in a label (where a button advances by displaying the next 3 online), but…
-
2
votes1
answer114
viewsRelating distinct foreign keys in a column?
Hello, I am creating a table to register materials or services that depend on two other tables to form your cost center (Foreign key), depending on the type of registration. If I’m going to register…
-
2
votes2
answers134
viewsDeserialize array of C#objects
Good evening! I have the following script in my View: $('form').submit(function(e){ e.preventDefault(); var resposta = new Array(); var x = 0; var y = 0; $(".resposta").each(function () { var dados…
-
2
votes0
answers36
viewsWhat is the best way to use Firstchanceexception in multithreading application?
I have an application (which is a Windows service) that currently runs N Threads. What I want to do is capture whichever error that occurs in the application to write to a log file '.txt'. Only I…
-
2
votes1
answer185
viewsHelp me consume the IBM Watson NLU API
Yesterday I watched a video of a guy who consumed Watson’s Natural Language Understanding API (IBM cloud) with JS using Node and he did some pretty cool things with it... On the other hand I’m…
-
2
votes1
answer160
viewsA3 Web Application and Token without Local Installations
My goal is a web system that serves as a bridge between a government service and the user, abstracting access and data exchange. The user would access my web system and could perform actions, such…
-
2
votes1
answer442
viewsC# - How to make an orbital camera around the player?
I’m trying to make a Storyteller game, and I want to make a camera similar to the one in the game Life Is Strange, but the camera only rotates along the X axis. using UnityEngine; using…
-
2
votes1
answer182
viewsEntity Framework Sum and Count different status
In my ASP.NET MVC project, I’m trying to achieve the equivalent of this SQL Server code: Select e.Numero, e.ValorEmprestimo, Count(Case when pvp.IdeStatus = false and pvp.DatVencimento >=…
c# asp.net-mvc asp.net entity-framework-6 entity-framework-coreasked 5 years, 3 months ago Pedro 186 -
2
votes2
answers72
viewsHow do I pass the right string value to my controller? from the error when returning to Edit View
**// Tentei destas duas formas e não consegui nenhuma!** // Onde tem item.nome é de um foreach que me retorna nome de uma pessoa <span data-toggle='tooltip' data-placement='bottom'><a…
-
2
votes1
answer111
viewsSum total value of each LINQ category
I have a Shopping List(Shoppingitems) like this: Descricao: Padaria Campobelo Valor: -24.00 Data: 06-03-2019 Categoria: Alimentacao Descricao: Uber tecnologia Valor: -24.00 Data: 07-03-2019…
-
2
votes0
answers79
viewsHow to create a custom Authorizeattribute in ASP.NET Core?
I need only a few endpoints in my API to use a different token, because they will be called by a less secure application and I don’t want that other token to have access to every application equal…
-
2
votes1
answer132
viewsRelationship one-to-Many Entity Framework
I am developing a crud of registration for a project. When registering the user(Employee) must inform a IdCity that is related to the table cities(Cities). How is it possible for me to automatically…
c# asp.net-mvc .net entity-framework entity-framework-6asked 5 years, 1 month ago vinilazzari028 23 -
2
votes3
answers653
viewsWhen to use if or Else If?
It’s a pretty silly thing, but during my writing I came across the following question: When is it really necessary to use if's or else if's in my code? Is there any impact on performance? I will put…
-
2
votes1
answer47
viewsHow to use AJAX that takes the value of a field for a select and returns to a modal in a partial view?
My code here: View: <tbody> @for (int i = 0; i < Model.lNaoIncluidos.Count; i++){ <tr> <td style="text-align: center;"> <span data-toggle="tooltip" data-placement="top"…
-
2
votes1
answer224
viewsHow do I play the variable within a text in "Messagebox.Show" of a "case" on the "switch" command?
I’m doing a program interface on switch using C# to find out what a couple’s wedding anniversary is, only that I do not know how to insert the result variable for the case default if the marriage is…
-
2
votes2
answers484
viewsHow to hide property in Efcore listing
Hello, I have a question regarding the Efcore Webapi of ASP.NET Core. I have my Service, Professional, User and Scheduling entities, where in the service I have a foreign key for the professional…
-
2
votes1
answer53
viewsHow to add Account to the Asp.Net Core project
I’m new to Asp.net core mvc and I’m having a hard time, I have a project that in visual studio I have a solution for 4 different projects. Let’s just say it’s Project A and Project B. Project A…
-
2
votes0
answers288
viewsSend view value to C# ASP NET MVC controller
I need to pass an ID of a forach inside a form of my view to the controller, but I couldn’t find the best way to do it. I tried to call a Hiddenfor with the ID in the foreach or call the value by…
-
2
votes1
answer60
viewsHelp in SQL query for LINQ
I have a problem/difficulty, I have this following SQL query that I need to transform it into LINQ, but I am having problems in LINQ COUNT(). select m.id_marca, m.ds_marca,…
-
2
votes1
answer83
viewsPrint Owin Identity Projects
How I can print all different types of claims that I created during my Owin Identity authentication? I’m using @User.Identity.Nome to be able to print only the name, I can’t access the other keys I…
-
2
votes1
answer110
viewsGet a list of mapped data in Nhibernate
I am trying to transform the data returned from the database to the settings made in my mapping, however I get the following criticism: "The value "System.Object[]" is not…
-
2
votes0
answers127
viewsFetch request with ASP . Net Core 3.0
I am trying to replace the Ajax methods by Fetch in the application, but I cannot receive an object with Fetch, I made a small test object to try to receive, in Ajax, with you passing parameter…
-
2
votes1
answer57
viewsHow to set a Returnpath in SMTP email sending
I’m making a console that sends emails. I need the emails sent with error to return to another email (other than the one sent). I managed to set the ReturnPath in the header email, but it didn’t…
-
2
votes1
answer311
viewsFraction sum problem in C#
Make a script to calculate and display the sum of the first "N" values of the sequence below. The value "N" will be typed (TextBox), should be positive, greater than zero, but less than fifty. If…
-
2
votes0
answers335
viewsConnection error with sqlserver when editing Connection Timeout in connectionString
I have a Webapi where I need to search the amount of records of a given table in sqlexpress on the production server, local I have no problems at all. I’m using ADO pure and with ExecuteScalar,…
-
2
votes0
answers365
viewsC#, The underlying link has been closed: Unexpected error while sending
I’m trying to communicate by webservice and always gives me the error: "Underlying connection closed: Unexpected error while sending." The method I’m using is this: private void GetATCode(string…
c#asked 4 years, 11 months ago jobuscador 21 -
2
votes2
answers75
viewsGet specific value in a txt file
I am trying to get two specific values on each line of a txt file. As an example: 15/06/2016 R$ 638,69 R$ 2.562,46 15/07/2016 R$ 672,43 R$ 2.533,51 15/08/2016 R$ 658,93 R$ 2.504,75 15/09/2016 R$…
-
2
votes1
answer149
viewsOnchange event in Input type="text" in a Blazor application
I am developing an application in Blazor and managed to do an inputtext along with a button perform a search in an api created by scafolding with Entity Frameworks. Follow simple form below.…
-
2
votes1
answer155
viewsDropdown materialize does not recognize click on smartphone in Chrome browser
I have a table that has a materialize dropdown, which when selected by PC/Notebook works normally. But when clicked by some mobile device with the same browser it does not recognize touch as click…
-
2
votes1
answer363
viewsVariable double receiving comma value in API - . Netcore
Hello, I created an API that receives two parameters from another project (requirement of college work), is the calculation of the BMI, so it receives weight and height and makes the calculation,…
-
2
votes1
answer71
viewsHtml.Beginform error with area
I have a view with the following form: @using (Html.BeginForm("Salva", "Blog", new { area = "admin" }, FormMethod.Post, false, new { id = "formCadastro" })) However, when clicking on Ubmit the url…
-
2
votes1
answer340
viewsUnable to install Npgsql 4.1.2 package. application . NET Framework
I’m trying to install the Npgsql to consume Postgresql data in my project , but returns me the error below: Severity Code Description Project File Line Suppression State Error Could not install…
-
2
votes1
answer67
viewsTheninclude of a List
I have an entity called Team (image 1) which in turn has a Icollection of Userteam (image 2) which in turn has a Icollection Applicationuser called Member. Goal: return a list of Teams with their…
-
2
votes0
answers81
viewsPhonedailer function with Serialport
I am implementing a c# application that needs to be automatically dialed. Searching I found a function Phonedailer.Open that receives in parameter the number of the phone. However I do not know the…
-
2
votes3
answers291
viewsAsp:Textbox type="date" is not completed
I am creating a form in Asp where a asp:Textbox should load the expiry date of a product, which should be filled in page_load() with the database data, and be free to change if necessary The problem…
-
2
votes0
answers155
viewsSSIS error: Cannot load script for Execution
Executing the data load generates the following error: "Cannot load script for Execution". The data load executes a Script Task. In this Script find a CSV file, in which it takes the date of the…
-
2
votes1
answer112
viewsSum of all integers within a List<int>
I have a way: public static int soma(params int[] n) { int resultado = 0; for (int i = 0; i < n.Length; i++) { resultado += n[i]; } return resultado; } On my console: List<int> numeros =…
-
2
votes0
answers38
viewsC# in Graphql: directly include an object in Type and also Inputtype
I have a class of users: public class Usuario { public int id { get; set; } public string nome { get; set; } } To use the above object in Graphql, I wrote the following code: public class…
-
2
votes1
answer134
viewsHow to perform mathematical operation within the MVC view
I am creating a web application MVC 5 for studies and I have a question: it is possible to perform a mathematical operation in view? I wanted to multiply line 16. What would be the solution?…
-
2
votes1
answer212
viewsAdd customizable SOAP Header
I’m consuming a web service SOAP which does not provide any information on Headers, nor of autenticação. I added the same in my project by the tool Add Connected Service in Visual Studio. Looking…
-
2
votes1
answer40
viewsStop the application after displaying a login error
In the code below, the desktop application has to log in to a system, but when the user/password is wrong, it gives me the error message, but after I give the OK it keeps running. I tried the…
c#asked 4 years, 6 months ago Marcos Carvalho 1 -
2
votes1
answer105
viewsHow to sync multiple buttons to an event?
Good evening, my teacher of programming language asked us to make a program, that when calling the event Form1_load generate 200 buttons, until then I did, but I wanted to implement a function that…
-
2
votes3
answers1489
views