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
-
0
votes0
answers42
viewsConnect via 64 bit odbc in Sybase database
I am trying to connect to a database via Odbc, and I use the driver System.Data.Odbc. In odbc 32-bit works already, in odbc 64-bit does not. IDictionary<string, string> properties = new…
-
0
votes0
answers39
viewsConnection string Sybase
I am trying to connect to a SQL Anywhere 12 database with iAnywhere.Data.Sqlanywhere.dll, and am having trouble specifying the connection_string. properties.Add("connection.driver_class",…
-
0
votes0
answers59
viewsUnit Test C# best practice
I have a test code for a method until quite simple to check. public bool EmPeriodoDeExigencia(ParametroProrrogacao parametroProrrogacao, Requerimento requerimento) { PreCondicao .Para("Determinar o…
-
0
votes1
answer39
viewsHow to get the first foreign table row with Entity framework core?
I have a table of real estate and real estate photos, with the respective models: Real estate [Key] public int ImovelId { get; set; } public int? CategoriaId { get; set; } public string Endereco {…
-
0
votes2
answers86
viewsHow to delete unreachable files from windows TEMPORARY folder with a C#application
insert image description here I’m trying to create a C# application to delete files and subfolders from the windows directory where the temp folder is located (C: Users Admin Appdata Local Temp),…
c#asked 4 years, 8 months ago Josimar Marcos 1 -
0
votes1
answer52
viewsHow to sort a list 1 to N with Expression lambda
I need to sort out a list and I don’t know where to start. I tried to apply the code below based on some posts, for example: https://stackoverflow.com/questions/298725/multiple-order-by-in-linq ,…
-
0
votes1
answer1132
viewsAPI Rest ASP.Net Core 3.1 returning 404 error when published
I’m doing some testing with Apis in ASP.Net Core 3.1. In this case, I am using Entity Framework to access the database and Identity Core to register and log in users. To do so, I have implemented…
-
0
votes1
answer425
viewsHow to send data array to Asp.net core controller
I have a screen where I have the registration of some items, in my control I am receiving the data of the array, but it is coming empty. I already tried some options here on the forum, such as…
-
0
votes0
answers299
viewsError: (The HTTP request to the remote Webdriver server for URL http://.. url timed out after 60 Seconds) when running test
When trying to run the tests in Internet Explorer the following error appears (The HTTP request to the remote Webdriver server for URL…
-
0
votes0
answers19
viewsProblem with matrix boundaries
Good afternoon! I’m doing vector exercises and found a problem where I don’t understand. The proposed problem was to place values on a vector A and B of size 5, and then merge these values into a…
-
0
votes1
answer31
viewsWhat is the best way to send post to register together with the child elements?
I am creating an Asp.net application with customer registration. I am creating the Create page, which has the client’s own registration fields. However, the customer can have multiple phones. Soon,…
-
0
votes1
answer297
viewsStartup at . net core 2.2 and . net core 3.1
I am taking the MVC core course from developer.io, but in the course . net core 2.2 is used and I am using version 3.1. In creating a MVC project from scratch the route configuration code in .…
-
0
votes2
answers137
viewsFormat date to dd/mm/yyyy using Datattables. Netcore
In my project I’m using the library Datatables for mounting of my tables, the problem is that it is returning the date in the standard american (format I write to the database) and am unable to…
-
0
votes0
answers37
viewsHow to add items from a JSON to a database?
Explaining: I have the following classes to work on, one that is the arrival and return of JSON and others, entities data, follows below: User experiment result: public class…
-
0
votes1
answer71
viewsUnity C# | Problem Using For Loop Inside Update()
Hello, My problem is this, I have a list of events that happen at a certain time, which is randomized, and when an event occurs a new timer is drawn to the next one adding another 10 seconds, all…
-
0
votes1
answer31
viewsApply filter to a list returned by a mock
Good night! I have the following scenario: A concrete class called Usersservice, which receives by injection of dependencies the repository through an interface and a notifier. She gets like this…
-
0
votes1
answer107
viewsHow to run an oracle database via c# with no data return?
I am developing a WEBAPI in c# that runs a precedent on Oracle and after this procedure, it queries a table. This precedent only deletes data from a time table and inserts the the data informed in…
-
0
votes0
answers20
viewsHow to resolve this object reference error?
when compiling the application to generate my report, I am getting this error message: The 550 line refers to this piece of my code that starts in the if: if (movimentacao.ValorCotacao == 0…
-
0
votes1
answer32
viewsNewline environement.Only works in the first line
Good afternoon. I am trying to generate a text file and it only works on the first line. From the second line, it gives you a space that you can’t solve. foreach (DadosSQL dados in listaDados){…
-
0
votes2
answers52
viewsI cannot insert in sqlServer table float data when they are greater than 1000
I am not able to insert double variables when they are greater than 1,000.00 because of the comma that Apare and so sql recognizes that I am trying to insert two data, I tried to use the…
-
0
votes1
answer94
viewsSave values from Combobox c#
Hello I’m a beginner in C# and have a combobox receiving data from mysql: mConn.Open(); MySqlCommand command = new MySqlCommand("select modelonome from modelo", mConn); MySqlDataAdapter da = new…
-
0
votes0
answers27
viewsEntity Framework - changing navigation property name generates schema validation error (edmx)
We have a . net system that uses Entity Framework 6 (database first). Some tables have more than one fk for another table. Entity, when generating navigation properties for these relationships,…
-
0
votes0
answers76
viewsHow to update a Partial View through a Post?
I am using Asp.Net Core Razor pages and need to avoid using Javascript/Ajax/Blazor in my code to create something like a control iterative, adding to the page a form at each button click and trying…
-
0
votes1
answer110
viewsCrystal Reports does not read the table when displayed by the applicator but le table in the Crystal Editor
Good afternoon, I am with a very strange error, I have a report in Crystal Reports that the same shows the data of a table (there is no form or parameter in the report it only shows the data of a…
c#asked 4 years, 6 months ago Maykon Luiz Matos Araujo 71 -
0
votes0
answers22
viewsHow to put an Object parameter on Route
I’m creating a way to send firebase push notification. There’s three pieces of information I need to pass along: string title, string body and object data When I started doing it, I did it like this…
c#asked 4 years, 6 months ago LeoHenrique 954 -
0
votes1
answer150
viewsHow to display a message in the view via a viewdata
How to create a message via a viewdata to the view? In the code below I am trying to validate if my user is null, it has to display the error on the screen for the user. Class public async…
-
0
votes1
answer42
viewsDoubt in the Linql
I have 2 tables: one for product and another with a conversion list. Could I make a single connection to the database without having to go to the bank several times? For example, to each product I…
-
0
votes1
answer43
viewsAsp.Net - Read Files
Hello, I need your help again. I’m working on a project that consists of reading XML files and storing the data in a table. I can already do that, but I have a problem. This is an example of an XML…
-
0
votes1
answer33
viewsHow to create a Controller for the Applicationuser
Good Afternoon, I’m trying to create an administrator area to manage the database accounts, but I’m having difficulties, I have the Applicationuser class and the Loginviewmodel class: public class…
-
0
votes1
answer77
viewsProblems with Datetime in Javascript with C#
Staff I have a class that gets a start and end date from a Javascript: public object getTime(DateTime inicio, DateTime fim) { ... } I’m going through the dates like this through Javascript:…
-
0
votes1
answer43
viewsI’m not getting to import a namespace that I created
Goodnight, I created a namespace called: Enums inside Models, when I try to import within a class the Enums, I’m not getting through... I’m with using Entity FrameWork with Asp.Net core MVC Folder…
-
0
votes0
answers35
viewsBackground routine for data compilation is a good idea?
The last company I worked for had some very peculiar rules, these not being as common (as far as I know) in other IT companies. Basically we compiled all the data that would be used in the system…
-
0
votes3
answers69
viewsHow to ignore other occurrences like this when capturing a snippet of a string?
I need to get just the ID of this line: "21 Julio André 21 Years" Since the ID is at the beginning of the line and is equal to age, the functions I tried to split the strings were Substring() and…
-
0
votes2
answers105
viewsMoq function in controller test
After a few hours trying, I arrived at this test code, but still I could not understand well the function of the Mock, and without it works the same way. Note. The intention is to learn TDD with…
-
0
votes1
answer32
viewsError in Unity 3D Javascript code
I’m doing a Voxel World Minecraft style in Unity 3D, but is giving the following problem: BCE0051: Operator '*' cannot be used with a left hand side of type 'System.Type' and a right hand side of…
-
0
votes2
answers78
viewsC# - How to open Form2 without losing the Textbox information that is in Form1 and vice versa?
namespace TesteAbertura { public partial class FormularioTeste : Form { public FormularioTeste() { InitializeComponent(); } private void…
c#asked 4 years, 5 months ago Marcio Valerio 5 -
0
votes2
answers45
viewsFind a lower value of a collection, according to one condition
I have two collections: A and B as List<int>, both of the same size N. In collection A, are the designs. In B, the offerings by the project. Illustrating: projects[5, 1, 4, 5] offers[8, 7, 6,…
-
0
votes2
answers30
viewsGrab text from Linklabel created in Runtime C#
I’m creating some LinkLabel at runtime with the code below: for (int i = 0; i < qtdresp; i++) { System.Windows.Forms.LinkLabel Lbl = new System.Windows.Forms.LinkLabel();…
-
0
votes0
answers30
viewsPrint Datagridview data without dark background
Hello! I have a code that prints out data from DataGridView, however, I modified the colors of it. Thus the code incorporates the color of the DataGridView to the printing page. I would like the…
c#asked 4 years, 5 months ago Marlon Pereira 465 -
0
votes2
answers153
viewsC# convert dynamic string to xml with TAG
I would like to know how to convert a string with XML inline to an XML with tags, I am using Xmldocument, I have the following code: var MihaString="<MeuXML Info01="teste 0121245"…
-
0
votes3
answers86
viewsDeserializeobject Json
Good morning, I’m trying to deserialize a JSON but there’s no way I can, I get the following JSON from another system:…
-
0
votes1
answer13
viewsC# Could not find Imetadataexchange
I have the following problem, when creating a WCF service says that Imetadataexchange was not found, my APP.config is: <?xml version="1.0" encoding="utf-8" ?> <configuration>…
-
0
votes1
answer20
viewsC# Define page orientation for a Webbrowser control
Hello. Referent: Windows Forms. I have a Webbrowser control on a form that is displayed to the user. This Webbrowser displays an HTML document in its Documenttext property. I can display the form…
-
0
votes1
answer48
views -
0
votes0
answers25
viewsHow to add new information in XML using serialization without overwriting previous information
Good evening guys, I am casually studying and creating some applications, I have reached a point where I need to create an XML with values, and that every time I enter information it goes to the XML…
-
0
votes2
answers249
viewsC# API Routes (Beginner)
I created a new project like: ASP.NET Web Application - WEB API I created a new controller, however, I’m not being able to differentiate the ACTIONS. If I have more than one method of type GET, at…
-
0
votes1
answer44
viewsOperationcompleted had already been called in the operation and other calls are illegal. Background Worker
I’m developing an application where I came across a mistake I’ve been consulting, but I couldn’t understand exactly how to fix it. In short: I created a form that opens as Dialog and gives me the…
-
0
votes0
answers31
viewsDependency Errors
I have a problem with the project dependences, yesterday I worked normally and today, as soon as I opened the project and built, the errors appeared... I tried to accomplish the clear, reinstall the…
-
0
votes1
answer190
viewsAccess a Singleton Repository outside the Controller (Dependency Injection)
I have a Repository instance added as Scoped in Startup and to access the instance I do the dependency injection by the Controller constructor, or by Fromservices. However, I need to access…
c# asp.net-mvc asp.net-core asp.net-web-api dependency-injectionasked 4 years, 4 months ago Jd3 Tecnologia 50 -
0
votes0
answers272
viewsAdd Reference to Visual Studio 2019
I used Visual Studio 2017, and had an area to add reference. When I switched to Visual Studio 2019, I noticed that the button changed its name. When I try to add a reference it doesn’t work, the box…