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
answer28
viewsHow to make an M:N autorelationation in the Entity Framework?
Good afternoon, I need to self-relatify and I’m really confused how I’m supposed to do this. In my system I have several process variables, a same process variable can be Father of several other…
-
0
votes1
answer1163
viewsMove mouse to screen pixel (XY)
Hello guys I’m having a problem, well I already managed to get the mouse position in relation to form ! For this I used a form with the NONE border, maximized, and opacity 5% and when the user…
-
0
votes0
answers172
viewsError deserving JSON: The JSON value could not be converted to System.Collections.Generic.Ienumerable
var stream = await response.Content.ReadAsStreamAsync(); var des = await JsonSerializer.DeserealizeAsync<IEnumerable<WorkingDaysDates>>(stream); [JsonProperty(PropertyName =…
-
0
votes0
answers89
viewsHow to order a Collection according to the Date and Time in C#?
I need to order the Personal Collection? You’re not ordering... Someone knows how to do this? public Pessoa GetJoinById(int id) { var pessoa = Db.Pessoa.Find(id); Db.Entry(pessoa) .Collection(x…
-
0
votes1
answer31
viewsMathematical operations of textbox values that comes with ex siphon: R$2.00
Good morning Guys, I’m having a problem making this code in C# I have a value in a textbox that comes automatic with the "R$" so I need to take the value that comes in this textbox and do…
c#asked 4 years, 6 months ago user187780 -
0
votes2
answers50
viewsHow do I reference a context in Entityframework?
I am developing a c# API and I use the Entity framework and I need to create an Migration. My API needs to connect with two databases the internal database and an external database, with this, it…
-
0
votes1
answer124
viewsXamarin.Forms Ios Webviewrenderer sharing Cookies
I am using a Webviewrenderer to configure the cookie policy and also to share cookies from an Httpclient login request. Turns out no matter how much I set: var cookieJar =…
-
0
votes1
answer162
viewsHow to validate data entry from a web service?
What is the best way to validate a Webservice call? I explain: I have a Webservice that has as Request a String of varied size and that returns the same string Formatted, example: Input string: "ST…
-
0
votes2
answers111
viewshow to do to auto-detect a serial port, instead of I place it manually
Instead of me having to manually place the port in the txt field, how to make it be auto-detect and fill the field ? private void btnSend_Click(object sender, EventArgs e) { try { SerialPort sp =…
c#asked 7 years, 7 months ago Mandrake Venom 170 -
0
votes1
answer228
viewsWhat is a byte array?
What is the byte array in Unity? I know we store data that can be converted into bytes.
-
0
votes1
answer279
viewsReturn total documents from a Mongodb Collection?
I made a api in C# and it’s the first time I’ve used Mongo as a bank and on a route I need to get the total records I have on my Collection. I tried several ways but could not find a way to return a…
-
0
votes0
answers49
viewsI’m having trouble creating a public async method Task<Actionresult> Synchronous action method C# Web API
I am having this problem to create a method in the API does not recognize the Actionresult…
-
0
votes1
answer53
viewsPotentiation with array
I thought of the following code to calculate the square of each value in array: double []vetor = {1,2,3,4,5,6,7,8,10}; double result = 0; foreach(double posicao in vetor){ result = Math.Pow(posicao,…
-
0
votes0
answers105
viewsError using a c++ dll in a C#code
I created a dll with a code in C++, when I went to use gave an error. function within the dll that I tried to use extern "C" __declspec(dllexport) void ClickLeftMouse(int x, int y){ POINT cursorPos;…
-
0
votes3
answers1210
viewsREST webservice GET method with token in external browser
I am developing a client who consumes a webservice, all POST methods are ok. Has a GET method that should return an HTML page for client registration. in this method, it is necessary to set the…
-
0
votes1
answer376
viewsShortcut to Console command.Writeline in C#, is there?
I know that in Java there is the command "Sout" and then press Backspace and it already generates the line of code.
-
0
votes1
answer326
viewsHow to use Validationmessagefor in Dropdownlistfor?
Please, can someone tell me how to use the @Html.Validationmessagefor for a @Html.Dropdownlistfor? Assuming the user has triggered the option to write from the system screen he should inform that…
-
0
votes0
answers40
viewsHow to execute a string’s instructions
I have a string: string str="for(int x = 0; x < 10; x++) Console.Write(\"hello\");" How do I execute the instructions for this string? for(int x = 0; x < 10; x++) Console.Write("hello");…
-
0
votes1
answer82
viewsHow to print a flumulario containing tables (grid) via c#
I need to generate a crediario card impression similar to the one that is attached. I have no idea how to do this, what tool to use. Could someone give me a hint? Thank you very much.…
-
0
votes1
answer72
viewsTable within the View
I’m placing a table inside the Edit view. View de Edit (Contract) @if (Model.ContratoParcela.Any()) { <table class="table parcela-lista"> @foreach (var parcela in Model.ContratoParcela) {…
-
0
votes1
answer958
viewsCompare variables with values from an SQL Server table C#
I have 1 table with 2 columns (Code and Value). I’m writing a code in C# and I have a variable taxpercentage. What I need is to return the column value Code, when the variable taxpercentage is equal…
-
0
votes2
answers57
viewsConsume a JSON result (beginner)
Hello, I have a very simple test. A method returns a JSON(), but how I access the values within this return? In the Test method I would like to use some value of the returned JSON. Could you help?…
-
0
votes0
answers22
viewsWhat are the positive and negative effects for command timeout 0 on string postgres connectivion?
Hello, I was constantly getting this mistake Response/Exception: An exception has been raised that is likely due to a transient failure. - System.TimeoutException: The operation has timed out. Then…
c# postgresql asp.net-core .net-core entity-framework-coreasked 4 years, 4 months ago Iago Soares 1 -
0
votes0
answers106
viewsXamarin Forms - Application closes when access certain Forms
I’m having a problem in APP, the application works perfectly when debugging it being on mobile(android) as in emulator. However, when I put it in production and installed by Google Play, only some…
-
0
votes2
answers116
viewsGenerate Log by day date C#
I have this code below, would be able to generate Log by date of day? Example: log_29072020.txt private void Log(string mensagem) { string ficheiro = Environment…
c#asked 4 years, 3 months ago Evanilson Silva 13 -
0
votes1
answer65
viewsC# Recover all dynamic buttons
I have a project in C# and I’m having difficulties. I need to retrieve the data from the dynamically generated buttons at the same time. In the project there are approximately 50 buttons to open…
c#asked 4 years, 3 months ago Fernando Marcelino 1 -
0
votes2
answers963
viewsI cannot apply Encoder to the text to correctly display "ç, accents, other special characters"
Hello, I need to gather some information from the station, and I’m getting it. However in the received text I cannot apply an Encoder to correctly display the special characters: I have tried using…
-
0
votes1
answer130
viewsMsbuild doubt about compilation C#
Hello, I have a project in C# windows Forms and I need to compile and generate the .exe with Msbuild. However, when I update the sources and run to compile, it gives error saying that the structure…
-
0
votes1
answer74
viewsdifferentiate between upper and lower case letters
I’m performing database query, but I would like to differentiate the uppercase letters from lowercase, because the way it is if I type test and value that is in the bank for Testing I get nothing in…
-
0
votes1
answer45
viewsImage resizing
I am using the following routine below to resize images, it is working, however the resulting files are getting a very large size, for example when I resize an image from 1400x700 from 500kb to…
-
0
votes2
answers110
viewsHelp with threards system
I wrote a small application in C#, where its main process takes a long time to run. I am having a problem with the lack of response of the graphical interface of the application while running this…
-
0
votes2
answers57
viewsName of the Linq Dynamics column?
I have a column that will receive the orderBy dynamically, by example: _context.Tabela .Where(p => p.colunaA.Contains(searchBy) || p.colunaB.Contains(searchBy) || p.colunaC.Contains(searchBy) ||…
-
0
votes1
answer64
viewsTruncated incorrect DOUBLE value?
Guys I have this UPDATE code to do, where it adds the previous value of the column (valor_abertura) with one who comes from UPDATE, but he gives the error: Truncated incorrect DOUBLE value. the…
-
0
votes2
answers1366
viewsGenerate an excel file from a data grid C#
I am trying to generate an excel file from a datagrid, and this is generating the following error: An unhandled Exception of type 'System.Invalidcastexception' occurred in Eletronictaxnotes.exe…
-
0
votes1
answer131
viewsSQL Report Builder 3.0 Merge Rows into a Totalizer column
Considering a simple query where you bring a list of people containing your name, code and age, I would like it to be displayed in the last right column the sum of the ages according to the image…
-
0
votes2
answers83
viewsCheckbox help in C#
I have this code. private void Verificar() { mUpdater = new DatabaseUpdaterService(); mUpdater.Initialize(false, null); DataTable dt = mUpdater.GetVersionCheckBoxToUpdate(); int h = 0; foreach…
-
0
votes1
answer327
viewsNew Line Stringbuilder message Box C#
I would like to show in a messagebox the records with line break. but the result is this: I’d like you to stay line by line; My implementation is like this : When I’m debugging, no builder.append I…
-
0
votes1
answer47
viewsHow to limit the highest numerical value to be typed in C#?
I wish I had a maximum number in charge: salario = Convert.Todouble (Console.Readline()); Example: if you pass 4000 you will be invalid.
-
0
votes1
answer86
viewsSelect with two context in entityframework
I need to make a comparison, from two databases, I need to bring the emails that do not exist in the other bank. I tried to do it this way: var email = _contextVO.Usuarios.Where(x => x.Ativo ==…
-
0
votes1
answer44
viewsDoubt about looking for buttons
The idea is: In the field of "Fetch Game...", I look for the buttons, which are already named with their respective games: btnArcheAge, btnDiablo3, btnWoW, etc. The tags are also already named with…
-
0
votes0
answers57
viewsIdentity ASP.NET Core, error "Cannot create a Dbset for 'Usuario' because this type is not included in the model for the context"
I’m starting to learn Asp.Net Core, and I’m trying a problem regarding a user registration, because when I try to create it returns an internal error with the message "Cannot create a Dbset for…
-
0
votes0
answers10
viewsWhat can determine whether a class relationship is strong or weak?
In this case, I am using c# and learning POO, so I would like to know the answer to this question: What can determine whether a class relationship is strong or weak?
-
0
votes0
answers10
viewsHow to generate different numbers
Why my code is sending me 2 equal numbers? for(int i = 0; i < 2; i++) { Random numAleatorio = new Random(); int valorInteiro = numAleatorio.Next(10000, 99999); Console.WriteLine(valorInteiro); }…
-
0
votes0
answers38
viewsHow to make a history
Hi, I have a question and I don’t know how to begin to resolve it. I’m using the Asp.net mvc and I have to create a history table, where it makes a copy of a certain part, even if I delete the…
-
0
votes1
answer108
viewsHow to pass a string as a parameter in Action
I need to pass as a parameter a string where it returns all items that have the same name. Here he is returning Null. With Id it works perfectly. [HttpGet, ActionName("Search")] public async…
-
0
votes1
answer648
viewsHow to read a JSON Object Array with Xamarin Android Newtonsoft.Json
I am working on an app that gets a response JSON and inserts some fields of it into a textfield android, here is the code: using System; using Android.App; using Android.Widget; using Android.OS;…
-
0
votes1
answer54
viewsC# How do published app use settings I changed in the app.config?
I have an app like Netframework Console, and I have the app.config in it. My app needs to use the tags from app config. that I change frequently to generate some text files, that is to say I have…
-
0
votes1
answer70
viewsRemove Background Checkbox Wpf Material Design
Folks I’m trying to leave the Checkbox only with the square mark and dash that says it’s marked. My code is this: <CheckBox Content="Teste"> <CheckBox.Resources> <SolidColorBrush…
-
0
votes1
answer47
viewsCorrect LINQ search syntax in MVC
I built an application with MVC that performs a query in an SQL database and returns it as a table, and now I want to add a search bar to that screen. I’ve already set up my "Index.cshtml" view…
-
0
votes1
answer94
viewsDoubt about Containsignorecase in a textbox
The problem is in the following description : CS1061 error "string" does not contain a definition for "Containsignorecase" and was not can find no method of extension "Containsignorecase" that…