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
votes1
answer198
viewsHelp to debug in visual studio
Is there any way in the visual studio from one breakpoint to another kind of thing that’s between them? I have a giant and complex system, which almost always gets as far as I want, and it is…
-
0
votes1
answer936
viewsLink calling method in Controller - C# MVC
I have a Mysql table that is shown on a page of my project: foreach (var item in Model) { <tr> <td>@Html.DisplayFor(modelItem => item.id)</td>…
-
0
votes0
answers27
viewsWhat is the difference between the two syntaxes with LINQ?
List<string> esportes = new List<string> { "Futebol", "Voleibol", "Basquetebol", "Natação", "Rugby", "Handebol" }; List<string> resultado = new…
-
0
votes0
answers46
viewsAspnet Core Synchronization Context (deadlock)
I had a problem with deadlock in my code in . Net framework, follows below the excerpt from it: public IHttpActionResult Get() { AsyncCall().Wait(); return Ok("Ok"); } private async Task…
-
0
votes2
answers45
viewsAbout Windows.Forms from C#
I’m on a database replication project and I’m going through a problem. When referencing a field that comes from a textbox it is bringing all the information from the textbox and not just the value…
c#asked 4 years, 11 months ago Fábio Pereira 29 -
0
votes1
answer65
viewsWhat is the main difference between Thread.Abort and Thread.Finish?
I started working with threads recently and came across the need to close a thread, eliminate it altogether. After some researches I discovered the methods Abort and Finalize, however I did not…
-
0
votes1
answer63
viewsDisplay an image when another image is not loaded
Hello, I’m making a web page on which images are taken from outside the server, but sometimes the image no longer exists, or the link broke, so I’d like to display another image. The code would be…
-
0
votes1
answer283
viewsValidate Business Rule
I’m using this sample tutorial Data repository to create a layered crud with Entity Framework with Code First. My question would be how to validate a business rule where a user with already existing…
-
0
votes0
answers72
viewsValue shown in production other than development
I have an application in ASP.NET MVC with the Entity Framework with an Oracle database, and the same one showing some wrong data, and this happens only in production, in Debug(locally) the data is…
-
0
votes2
answers203
viewsCommunication between Code Behind and Viewmodel Xamarin
I have two pages created on Xamarin.forms, on the first page I have a list and on the second I have the details of each item selected previously. I send the selected item from the first page to the…
-
0
votes0
answers254
viewsUnable to locate column 22276451.
Good morning, I’m developing a code that can accept the X and Y values of a Chart I entered in Asp.net. For this I made a query to sql server so that it could be returned to a column media, until…
-
0
votes1
answer62
viewsMake Sort of a list
I am trying to make a Sort of a list that has information from a text file, to fetch the information from the file I use: string ficheiro = "tvInfo.txt"; List<string> Classificacoes; var linha…
-
0
votes1
answer36
viewsWhat use is the Viewstate?
In an application where I started maintenance, there are several mentions in the code. And so I would like to know what it is and also what it serves and stay more in touch with what the application…
c#asked 4 years, 10 months ago PedroBelino 176 -
0
votes0
answers37
viewsData protection against changes in Mysql
I need to protect a system’s data against database changes. It’s a system that uses financial transactions. I need a mechanism to prevent someone with access to the database from making changes to…
-
0
votes1
answer92
viewsProcess does not run high
I made a program to run the windows activation process high but I get the message of insufficient privilege despite being with Verb = Runes var senhaSegura = new System.Security.SecureString(); var…
-
0
votes1
answer59
viewsHow to call a c# script inside a python script
Good morning, I did a lot of research and found that it was possible to fire a python process inside c#, my question is whether it is possible to do it the other way around, that is to fire a c#…
-
0
votes1
answer84
viewsSelect does not display data in listview
I cannot get feedback from my select in the database. Where I show the data in a listview. using (_connection = new MySql.Data.MySqlClient.MySqlConnection("Database=roubo_furto; Data…
-
0
votes1
answer76
viewsHelp with window array display (WPF template)
Be the code snippet: Janela[] jnl = new Janela[3]; for(int i = 0; i < jnl.Length; i++)//inicializa os objetos janelas { jnl[i] = new Janela(); } //Código que produz o layout de que cada janela…
-
0
votes2
answers355
viewsError 1 The type or namespace name 'Datareader' could not be found (are you Missing a using Directive or an Assembly Reference?)
Good afternoon, I was performing a code to query my database when I appeared these error: Error 1 The type or namespace name 'Datareader' could not be found (are you Missing a using Directive or an…
-
0
votes1
answer157
viewsMirroring of PDF text
I am trying to invert a text so that the mirrored text is saved in the PDF; however, I was unsuccessful, I tried in several ways and what made more sense was to rotate 360º and invert, but the text…
-
0
votes1
answer53
viewsUnsolicited Truncation of Time
I have a model designed to record a time used in a task: public TarefaHoraPendente() { HorasAcumuladas = new TimeSpan(0, 0, 0); Pausada = false; } public int ID { get; set; } [Required(ErrorMessage…
-
0
votes1
answer138
viewsError calling form screen
I’m having trouble loading a menu through another screen follows my code below. What would be a possible solution, for such error? public partial class frmMenu : Form { public frmMenu() {…
-
0
votes1
answer83
viewsHow can I use CSS styles in windows Forms c#
I have a lot of difficulties in doing the graphical part of the programs, someone who can help me with some simple example, it doesn’t have to be very complex, because this is a final course work.…
-
0
votes0
answers62
viewsOne control - multiple properties
I have a Combobox and it has as itemssource a struct with some properties, and I have a viewModel that has some properties of this struct, i wonder if there is a way to make the combobox set the…
-
0
votes1
answer48
viewsMainwindow changes size by itself when running the application
Greetings! I created a small XAML window in a WPF project where in Design view is perfect, but when I run the application in Debug mode the window changes in size on its own. What to do so that the…
-
0
votes0
answers28
viewsASP.NET MVC project using Entityframework
Guys, a very beginner question, I did an ASP.NET MVC project using the Entityframework, I did using the standard Unitofwork: public class UnitOfWorks : IDisposable { // Context private AgendaContext…
-
0
votes2
answers548
viewsHow do you get value from the serial port?
With the code below I get four values (1,2,3,4) sent by the serial port of Arduous, values are not sent together or will come out 1 or 2 or 3 or 4. serialPort1.Open(); string entrada =…
-
0
votes0
answers268
viewsStreamwriter inserting blank lines
I am implementing the download of a file in ofx, I am generating the string and then adding to a Streamwriter, but if I add row by row or add the entire string at once without breaking lines, it…
-
0
votes1
answer271
viewsHow can I "Update-Migration" vscode?
I want to use Entity Framework Core Migration but use the visual studio code. I’m trying to find a nuget extension in vscode that you can change on the command line (like a cmd), but I can’t find…
-
0
votes0
answers188
viewsAdd two values and show the result inside a label in c#?
{ int valor7, valor8; valor7 = Convert.ToInt32(txtMoeda7.Text); valor8 = Convert.ToInt32(txtMoeda8.Text); resultado1 = valor7 + valor8 lblResultado1.Text = resultado1.ToString(); }…
c#asked 4 years, 9 months ago Marcio Valerio 5 -
0
votes1
answer37
viewsHow to set a #if or #define conditionally?
Good afternoon, everyone... I’m helping a staff to make a PC game mod compatible with their Android version (Stardew Valley). The problem is that I need to use methods that only exist in the android…
-
0
votes1
answer31
viewsMarking changed properties instead of using the traditional Update is a good practice? (Ef core)
I have chosen to use the update in this way: _context.Entry(site).State = EntityState.Unchanged; _context.Entry(site).Property(x => x.Name).IsModified = true; _context.Entry(site).Property(x…
-
0
votes1
answer47
viewsWrong location with Chrome and Firefox
I’m capturing the Location of an image element. When I search for Phantom, it brings the correct X/Y coordinates, but if I do it through Chrome or Firefox, it gives another Location and then I can’t…
-
0
votes1
answer664
viewsPush notifications
I am developing a program in which several users will use, and would like to develop a system with notification Push, for when some user performs a Insert in the database. I would like it to be, for…
-
0
votes1
answer35
viewsCapture checkboxes marked in a View
I’m listing my objects through a ViewBag sent to the View, and for each item there is a checkbox, and for each contract there is an Id: @foreach (var item in ViewBag.Contratos) { <tr>…
-
0
votes1
answer56
viewsReturn amount Asp.net MVC
I have a model with category, Deposit, Date, Amount, I need the Amount add all the deposit that exist in the database and returns in the View, I did the following, only it didn’t solve. public async…
-
0
votes1
answer32
viewsUsed AUTO_INCREMENT to create ID numbers
I am using AUTO_INCREMENT to automatically add an ID whenever I create a new column. However when clearing a column, the ID number continues to add +1 instead of starting from where it left off. How…
-
0
votes1
answer2764
viewsHelps with over processing
I am writing an application in C#. My application works well processing up to a certain amount of data. However, if this amount of data increases significantly, it enters a state named by Visual…
-
0
votes1
answer70
viewsUnity C# error CS0411
I am having an error in 4 codes in which I do not understand the error. The error that is returned to me is this: error CS0411: The type arguments for method 'Component.GetComponent<T>()'…
-
0
votes0
answers59
viewsHow to convert an array of bytes of a text into English without replacing the accented letters with special characters in c#?
I have the following code snippet string xmlText = Encoding.UTF8.GetString(relFinalProj.XmlAnexo.MidAnexo); where the "relFinalProj.XmlAnexo.Midattachment" is an array of bytes. When encoding all…
-
0
votes1
answer25
viewsManipulate string with Substring
I’m trying to manipulate a string I’m running the code: string oldString = ",,,,,1001,1002,1003,1004,1005,1006,1007,1008"; string newString = oldString.Substring(oldString.IndexOf("1")); I want the…
c#asked 4 years, 8 months ago Thiago Pereira 179 -
0
votes1
answer81
viewshttppostedfilebase null after reloading the page, (image upload)
Is there any way I won’t lose data from HttpPostedFileBase? my action makes a check, and in case of failure the page recharges with the image in the form and I have to make the call again, then…
-
0
votes1
answer43
viewsDoubt in the Operator Conversion
I have a question about converting an operator into a c# struct for VB. C# public static Angle operator +(Angle a) { return a; } Vb Public Shared Operator +(ByVal a As Angle) Return a End Operator I…
-
0
votes1
answer1686
viewsInput string was not in an incorrect format
I am developing a three-layer application, but there is a mistake when saving other data types that are not string type! Follow the code below: //Camada dados Método inserir produto! public string…
-
0
votes0
answers69
viewsHow to identify a number on the screen with Bitmap?
I am new in C# and I plan to make a program to identify numbers on the screen and turns them or saves them into a Double variable. The only thing I could do was take the screen print :P Bitmap…
-
0
votes1
answer141
viewsC# Array number next
I’m in need of help I don’t know but where to turn. The problem and the following we have an Array of type Double. We have a variable x = 91.30 in the Array (a) the nearest value is 91.39. I wanted…
-
0
votes0
answers40
viewsVisual Studio - Include in project
Good morning, I am in a project where I use Visual Studio for the C# backend and VS Code for the JS front. When I create a folder in vs Code, I always need to go to Visual Studio’s Solution Explorer…
-
0
votes0
answers76
viewsCreate a Crud with a table with relationship N to N C#
I have this structure and wanted to know how I do a CRUD with a relationship N-> N My doubts : 1 - How to list participants of a given event. 2 - How to include a participant in an event.…
-
0
votes2
answers161
views -
0
votes0
answers186
viewsHow to resolve a problem in C# when executing the ". Executereader()" command and error is returned?
I am trying to execute the command "Executereader()" and always returns the error "threw an Exception of type 'System.Invalidoperationexception". The idea of this part of the code is: Open a ". xls"…