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
-
3
votes1
answer104
viewsHow to create an Object in a Linq.Expressions.Expression and add properties dynamically to it in C#
Hi, I’m creating a library of DataAnnotations to extend Entityframeworkcore with structures that today only exist using Fluentapi. In one of them, I’m trying to recreate this block of Fluentapi:…
-
3
votes0
answers190
viewsWhat is the difference between the terms X.509 and PKCS#7 in digital certificates?
Via a Webapi . Net 4.6.1 I am integrating with a service that requires data to be sent on a connection TLS 1.2 duly digitally signed using the standard PKCS#7, but when checking an example of…
-
3
votes0
answers520
viewsDownload file with Selenium Chromedriver in headless mode
I am trying to download a file in headless mode. I installed the driver like this: public static IWebDriver CriarWebDriver() { var options = new ChromeOptions();…
-
3
votes1
answer804
viewsReceive data from Alpha via serial in C#
I need to make an application that sends and receives data from an Aryan Eonard. I searched some examples of serial connection between c# and Arduin application and in all examples I had the same…
-
3
votes1
answer66
viewsHttpclient reuse and an Apicontroller lifecycle
Based on that website and also in some answers from Stackoverflow [en] I came to the conclusion that I shouldn’t use the class HttpClient in a block using despite the same implement IDisposable.…
-
3
votes1
answer91
viewsExcessive use of pens c#
Good morning friends, I am developing an application that should draw 4 graphics (for now), to draw in the way intended need to redraw the graphics several times and update them. With excessive use…
-
3
votes0
answers119
viewsBinding between components with XAML and C#
I need that when selecting an item in a combobox, the textbox is released for editing and its completion is required, as image below: This Binding is being active by clicking on the new button,…
-
3
votes2
answers351
viewsSum values from a column in the database via date filter
I need to sum all the values of a column containing in each row a specific date, that is, in the database, the values are saved with the date typed in the textBox in the act of registration, and I…
-
3
votes1
answer123
viewsWhy can’t I hash the password in my Seed method?
I’m trying to use my method seed below to create a user in the database when it is created: protected override void Seed(CodingCraftMod1Ex4AuthMembershipContext context) { string password =…
-
3
votes1
answer421
viewsOpen file from a network folder
Hello! I need to open a certain file located in a folder sharing done through Samba Server on Ubuntu Webmin. The code below seems functional, but I get the error code: Incorrect user or password.…
c#asked 5 years, 9 months ago Marlon Pereira 465 -
3
votes1
answer98
viewsForm losing model list
I have the following models: Models public class Atividade : BaseEntity { public virtual int Id{ get; set; } public virtual string Descricao{ get; set; } public virtual IList<Anotacao>…
-
3
votes1
answer521
viewseSocialBX: Invalid signature error
I am trying to consume the Event Identifiers Query Webservice. But I get this return from the Recipe: <eSocial…
-
3
votes1
answer74
viewsQuery search C# Oledb
In the program I am working on, I have made a data search form, where the name entered will be searched in the database and will return next results (Search screen) The problem is that the query…
-
3
votes2
answers395
viewsC# With Selenium - Doubt about xPath
I am automating a page function and when it will click on the error image, finally I have tried several things, my doubt is the following the xPath that I am sending is correct? <div…
-
3
votes1
answer44
viewsPlay list in an array
I created these two variables to be one array public static string[] doc { get; set; } public static string[] doc1 { get; set; } And I have these two items, where is a list var xDoc =…
-
3
votes2
answers900
viewsError while trying to add session to startup
I have a problem, always when I will compile the solution this giving error: System.Invalidoperationexception: 'Unable to resolve service for type 'Microsoft.AspNetCore.Session.Isessionstore' while…
c# asp.net-mvc asp.net-core visual-studio-2015 dotnet-cliasked 5 years, 8 months ago Thiago Corrêa 119 -
3
votes1
answer191
viewsRotate image around the center itself
I am developing a C# application and would like to know how to freely rotate a bitmap which is drawn in a pictureBox without rotating all _pictureBox_e so that the bitmap Rotacione around its own…
-
3
votes1
answer126
viewsLosing data while communicating with C#
Man Arduous sends data continuously to my C# via serial port. However, I understand that the first figures sent by Arduous are simply disappearing, sometimes disappear more numbers, sometimes less,…
-
3
votes1
answer77
viewsHow to redeem data that was saved in the bank during a creation process
In some Orms Nodejs I have this feature. However, I would like to know how to rescue an entity that was persisted in the bank? For example: User has an attribute ID. If I return the item, the ID…
c# entity-framework asp.net-core entity-framework-coreasked 5 years, 8 months ago Thiago Cunha 1,356 -
3
votes1
answer83
viewsCode works with a messagebox but no no?
Good afternoon, I’m doing a little school work to learn how to control radio Buttons with a switch in winforms public Form1() { InitializeComponent(); Form1.CheckForIllegalCrossThreadCalls = false;…
-
3
votes1
answer1023
viewsHow to create a . bat file directly from C#?
I am making a program in C# and in it I run a file . bat Look how I turn the file: string batDir = string.Format(@"C:\Users\Desktop"); proc = new Process(); proc.StartInfo.WorkingDirectory = batDir;…
-
3
votes1
answer469
viewsHow can I "pick up" values from one or more INPUT after clicking on a SUBMIT button in ASP . NET C#
I’ve been having the following problem: I have a registration form in which the customer must enter his data through the Inputs, at the end there is a button of type Submit, and when clicking it…
-
3
votes1
answer133
viewsDelete multiple database elements
I have a action [GET] delete on my Webapi. She removes one element, but would like it to remove all the elements that have a particular code. How can I change my code to remove all? My Code:…
-
3
votes3
answers231
viewshow to insert a select command into the BD using c#?
I wanted to have a table of select commands in the bank, and they were read in a combobox. I have a textbox where I write the command to be executed by the bank, a button for it and a combobox with…
-
3
votes1
answer75
viewsWrong Linq expression when avoiding repetitions on a List
I’m trying to avoid duplicate data before giving a set value. I have a class Player that has itself a property called NickName, this class is inserted in List. Player class: public class Player {…
-
3
votes1
answer128
viewsHow to compare two lists by property?
I have two student lists. I would like to compare them by the attribute Name, and return only the unique values of the student. In the example below, return only Aluno01.Name = "5555".…
-
3
votes3
answers92
viewsLeave date only on the datatime, without the hours part
Hello, I have a project that calls a WebApi which brings the data from the database, but one of the fields in the database is of the type DateTime and in my project, I declared as String (I can…
-
3
votes1
answer5597
viewsERROR The index was outside the matrix limits (System.Indexoutofrangeexception)
//Esse código tem o objetivo de substituir uma letra por um código string usuario = Environment.UserName; string palavra = usuario.ToLower(); int tamanho_array = palavra.Length; var array = new…
-
3
votes2
answers70
viewsFor in Javascript with user input
I have a form field that receives a value inteiro, this field in the form has the function OnKeyPress, I need the user to enter some value this value goes to the for ex: the user has typed 5, the…
-
3
votes1
answer135
viewsHow to go through an array at each click on C#?
I’m trying to make a Image Viewer for multi page Tiffs. I’m wearing a PictureBox and two buttons - one to move down and to the next page, and one to move up and to the previous page. My code goes…
-
3
votes2
answers105
viewsHow to change the value of several variables of the same type, for the same value, at once?
I was wondering if there’s any way to change several variables of the type bool for the same value, true or false, all at once? I have several methods that are similar and do the same thing, only…
-
3
votes1
answer70
viewsDoubt on the link of two tables to bring in view
I have a Brand table and a Model table, where at the time of listing all brands I can bring from the bank and send to my controller, only at the moment I do the research to list the Templates and…
-
3
votes2
answers96
viewsReadalltext returns Chinese characters
I have a file. 55GB sql and needed to run line by line, but as I cannot load a file of this size, I divided into 543 100MB files named as Imagens<NumeroSequencial>.sql. So I made a code that…
c#asked 5 years, 7 months ago Leonardo Bonetti 5,313 -
3
votes2
answers90
viewsUPDATE in a query with multiple entries
I have a query where I have a SELECT from a client ID, and an order ID. Later I perform an UPDATE in a table, changing the tax rate on the selected order. The problem is that a customer may have…
-
3
votes0
answers136
viewsUpdate all View data via Ajax
I need to update all my data View, i call this function to update, passing the company parameter: function CarregaCaixa() { var Empresa = $("#EmpresaFiltroId").val(); var url =…
-
3
votes1
answer57
viewsDatatable for a class
I am a beginner in c# and right now I have some doubts about how to pass the structure of a datatable for a class to later use it, this to avoid duplicate code since I have several tables that use…
-
3
votes1
answer145
viewsLeft Join with a table does not return null value
I have this select: var pesquisa = (from p in db.Produtos join pe in db.ProdutosEmpresas on p.Id equals pe.ProdutoID into peph from pe_ph in peph.DefaultIfEmpty() select new { p.Codigo, p.nome,…
-
3
votes1
answer288
viewsReturn View without losing data
I have a code in my controller that makes some procedures, if any of these procedures go wrong, it returns me to view that I desire and in the view I display some messages, this mine view is a view…
-
3
votes1
answer302
viewsC# and Entity Framework with Foreignkey between classes
People in my projects .Net MVC use the structure below. My projects, are with Entity Framework. The briefcase Entidades, are the classes I use in DbContext. Detailing the problem I have the class…
-
3
votes2
answers319
viewsHow to scroll through an enumerable list and check if the property repeats in the list during foreach turns
I have a list (IEnumerable) called People that contains the properties Id, Datanasc, etc... I need to bring this data to a listview in the html using the Razor (or it can be outside the cshtml page,…
-
3
votes2
answers82
viewsSave changes to the bank
I am trying to change the data saved in the Database, basically when I double click on DataGrid he populates my TextBoxs to make the changes in the bank, but when I click to save it from the…
-
3
votes1
answer512
viewsSerialize composite object into a single json
With Newtonsoft.Json, to the next object: public class Person { public string Name { get; set; } public string GeneralText { get; set; } public Address Address { get; set; } } public class Address {…
-
3
votes1
answer294
viewsDownload zip file from a URL
Good evening, I need to download a zip file and save to a server, however, with the code I am using below, it just creates the zip file on the server; when opening it, there is no file in it and is…
-
3
votes2
answers86
viewsError saving BD change in C#
I have a certain error when making changes to some data registered in the database, picture below the error also follows the code used: private void btnSalvar_Click(object sender, EventArgs e) {…
-
3
votes0
answers645
viewsAjax always returns HTTP error Error 404.15 - Not Found ASP.NET MVC 5
I use ASP.NET MVC 5 and developed a website, when I execute the following Ajax request: $.ajax({ method: "POST", url: "/Galeria/AddGaleriaItem", data: { ID: galeriaID , ObjectString:…
-
3
votes1
answer33
viewsProblems with wpf Data Grid
Good night. I am developing a project but I am having problems, I use a list that is being generated with the data of my database (Entity for connection), I want to populate a data grid but I do not…
-
3
votes1
answer251
viewsError running Entity Framework
I am starting my studies in EF, following this tutorial, I made up to 22 min of the video, then when I will run: System.Typeinitializationexception: 'The 'System.Data.Entity.Internal.Appconfig' type…
-
3
votes1
answer217
viewsHow to use denial in Contains c# with LINQ?
I need help, I’m starting in development, eclistIds returns me two ids, and if I don’t use the negation ( ! ) it returns me the id I don’t want, when I use the negation to return the other id,…
-
3
votes2
answers113
viewsNullreferenceexception
I was doing tests, until I received the following error: Object Reference Not Set To An Instance Of An Object Researching found that it is the famous NullReferenceException, then I was obliged to do…
c#asked 5 years, 5 months ago Jeff Henrique 1,020 -
3
votes2
answers226
viewsError in program c# with vectors
I’m having a problem on line 18 of this code that says:"There was an untreated "System.Indexoutofrangeexception" exception in Consoleapp19.exe The index was outside the matrix boundaries. How to…
c#asked 5 years, 5 months ago user147903 31