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
-
1
votes1
answer57
viewsError executing a subquery in sql server
I am trying to return values where the date is between two fields of my page this field and max(field) This is the consultation: SELECT COD_SECAO , SECAO , CHAPA , NOME , DTNASCIMENTO , DATAADMISSAO…
-
1
votes1
answer101
viewsBirth date validation with LINQ
I am doubtful to conduct a consultation. I need to list in this query only the offers that are within the age group listed in view in the fields IDADEMINIMA and IDADEMAXIMA passing only the…
-
1
votes1
answer100
viewsArraylist in C# does not display user-typed values
I made a Arraylist in C# that shows only the name, age and course of a student . But the CS0029 error says it is not possible to implicitly convert string to paraint on line 27 and 37, before I…
-
1
votes1
answer64
viewsHow could I sort a list of records, from a certain attribute of my class in C#
How could I sort a list of records, from a certain attribute of my class as "Code"? My class being next: private int Codigo; private string Nome; private float SalarioMensal; private string CPF;…
-
1
votes1
answer58
viewsReading text file in C#
I’m trying to make a small improvement in my automated algorithm on C#, my file ". txt" reads in the Email Inbox folder @empresa.com.br and writes only these @empresa.com.br in another file ". txt"…
c#asked 5 years, 1 month ago Leandro Azevedo 303 -
1
votes0
answers73
viewsChange property of a XAML control by changing value of a property in viewmodel
I have a Page with this style: <Border Padding="{Binding InnerContentPadding}" > <Border> <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">…
-
1
votes1
answer111
viewsC# - LINQ ERROR "The data type text and varchar are incompatible with Equal Operator"
I find the following error when trying to update a table: the data type text and varchar are incompatible with Equal Operator. I have done several searches and most indicate the same solution:…
-
1
votes0
answers17
viewsCloud Save app creation for premium users only
I work with React-On and have an interest in creating an application that saves in a cloud database for premium users only. The user would normally persist on the local device, but if I had a…
-
1
votes2
answers58
viewsOrganization for future code maintenance when I have two similar functions
I have two functions, one returns only the first result and the other also returns the first result or returns more than one result. I created the "string all" parameter to define whether to return…
-
1
votes1
answer107
viewsPrigrelha Showdialog loses Focus
When using the prigrate in a user form with Showdialog spring loses Focus. I tested with the code available here:…
c#asked 5 years, 1 month ago Bruno Silva 11 -
1
votes1
answer2188
viewsNullable Object must have a value
I have this SELECT, where m.EmpresaID may come null: var pesquisa = from pro in db.Produtos join prodempresa in db.ProdutosEmpresas on pro.Id equals prodempresa.ProdutoID into Details from m in…
-
1
votes1
answer65
viewsSpeech recognition is giving stack overflow
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Speech.Synthesis; //namespace using System.IO; namespace SIF { public…
-
1
votes0
answers42
viewsError in Deserialize C#
By taking the information from my Json and trying to deserialize, the same error or displays 0, I have tried N methods, does anyone give me a light? I thank you from the outset, follow the code.…
-
1
votes0
answers98
viewsProblems accessing external C#API
I am trying to access the Pagseguro API to view the account balance but the following error appears. (I deleted my email and token in the print as well as in the code below). Document print: Code on…
-
1
votes2
answers98
viewsJson for List C#
I have this Json (Json 1) { "2": { "Data": "28/10/2019 12:50:26", "Id": 2, "Id_usuario": 0, "Latitude": -2, "Longitude": -52, "Portas": 8, "Status": "CHEIO" }, "5": { "Data": "28/10/2019 12:39:33",…
-
1
votes0
answers30
viewsCode priorities in C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; namespace ProgramacaoParalela { class Program { static…
-
1
votes0
answers569
viewsPost with JSON - Httpclient C#
I need to do a Postasync in my web-api, passing a JSON as parameter. I tried it as follows, but I have not had success so far... Regardless of the structure of this JSON, I get a Bad Request when…
-
1
votes1
answer195
viewsFilter Json Using C#
I have this script in c# that makes me recover a token from an external api to mine that I am developing. Until then, I managed to recover without problems the parameters of this api (the token is…
-
1
votes0
answers37
viewsHttpselfhost Serialize daughter entities + Session nhibernate
I have the following method: // GET: api/Pedido/5 [ResponseType(typeof(Orcamento))] public IHttpActionResult Get(int id) { using (OrcamentoRepository or = new OrcamentoRepository()) { var orcamento…
-
1
votes1
answer49
viewsSpecial characters on the return of the Request.Form method
Good afternoon, my dear, I have an ASP.NET Webform project that reads the form post using the Request.Form method. I play this method in a string but it comes full of space characters. s Excerpt…
-
1
votes0
answers35
viewsData ordering C
I am doing an ordering job where the program should read a text file with several lines and do the ordering of values. are 6 files, one with 10000 records, another with 100000 records, another with…
-
1
votes0
answers109
viewsRecover value from an HTTP
I found a question four years ago that "would be" exactly what I need: I have a URL where it returns an HTTP Querystring, and I need to recover URL information and convert into variables to make…
-
1
votes0
answers72
viewsHow to handle an Exception of an http Request in Asp Net MVC
Hi, I have an app on ASP.net MVC who’s making a requisition http through a connection port that is available through a service, which is running on the server. The controller calls the method and…
-
1
votes1
answer55
viewsDatagridview - Problem changing column names
I have a table with the following fields in the order they were created: idProdReceita, idReceita, Quantidade, Imagem, Descricao, Fornecedor, Medida, Unidade, Valor When I load the Datagridview in…
c#asked 5 years ago Oto Emerson 25 -
1
votes1
answer238
viewshow to make a field mandatory
I’m maintaining a page using Asp.net MVC and using Kendo Asp.Net MVC and I need to make two fields mandatory, but I’m not getting it index.cshtml: <div class="col-lg-2 demo-section k-content"…
-
1
votes2
answers889
views -
1
votes0
answers87
viewsC# - Application in Xamarin causing slowness after some time
Hello, All right? I am creating an application in Xamarin Forms, however I am having some problems of slowness. In this application, I use a lot of parallel processing, and the application works…
-
1
votes0
answers133
viewsSave 3 decimal places to sqlServer
Personal I have to save 3 decimal places in my database SQLSERVER, however this saving only 2 houses for example I have a value 0.456 and when saving is 0.450 in the code : using…
-
1
votes0
answers17
viewsLine of a code for a program in C#
private void btnEditarProduct_Click(Object Sender, Eventargs and) { if (btnEditarProduct.Text == "EDIT") { txtName.Text = dtgProduct.Rows[dtgProdut.CurrentCell.Rowindex].…
-
1
votes0
answers18
viewsWhat exactly is the function of the Identitymodels class in C# and how does Applicationdbcontext work?
I developed an application in C# where I have the class Identitymodels, where from it I created a list of my classes based on Applicationdbcontext. I used Migrations to create the tables in the…
-
1
votes1
answer214
viewsField validation problem in ASP.NET Core
The field Unit Value accepts only 3 digits after the comma. I need it to accept 4 decimal places. I wonder what might be causing this restriction regarding the formatting of this field. The code I…
-
1
votes1
answer175
viewsUnable to convert from decimal to double
The abstract class Figura has the virtual method CalculoArea(), where the derived classes called Quadrado, Retangulo and Circunferência override this method according to its geometric figure…
-
1
votes1
answer53
viewsPlace only one item per line in a Listbox
my listbox is putting two or more items in the same row when it fits. How can I force it to put an item per line? Follow the code below: html <asp:ListBox ID="OC02_SERV_SOL" runat="server"…
-
1
votes1
answer88
viewsFill variable with different types
I have many fields to pick up so it is very bad to make a function for each connection and they are uncharted banks so using something like the Entity Framework is also not feasible if (1 == 1) {…
-
1
votes2
answers120
viewsWhat is the correct place to store the validation messages in a . NET project?
I’m creating a relatively simple class, but I’ve included some validations in its properties. public class Sala : EntidadeBase { #region Enums public enum StatusSala { Disponivel, Reservada,…
-
1
votes0
answers32
viewsSimple doubt about this use of Decorator in c#
I’m learning to use the pattern in c#, and it’s all flowing very well except for a single question that makes the author of this example, but it is bothering me a lot because I turn the code several…
c#asked 4 years, 11 months ago user171472 11 -
1
votes1
answer281
viewsHow to use Bindproperty in variables where names are dynamic in . net-core Razor pages
In Asp.net core Razor pages to pass data from a form declared as follows: [BindProperty] public int NMembro1 { get; set; } Where on the form side the tag input is stated as follows: <input…
-
1
votes1
answer28
viewsInsert combobox items using Entity Framework
I have a Windowsforms application and I’m trying to insert items from a combobox and save to the database using Entity Framework Core. The biggest problem is that it inserts only one combobox item,…
-
1
votes1
answer291
viewsAccess denied for remote access via WMI
Hello! I am trying to perform a remote access via WMI on a server with domain other than my machine, but when I try to access the following code is returned: Access denied. (0x80070005…
-
1
votes1
answer48
viewsMap Procedure in Entityframeworkcore
I am using Entityframeworkcore 3.0 together with Stored Procedure. The Procedure sp_login returns the following data: cod_us A B C D E 111342 1 1 1 0 0 111342 1 2 1 1 1 111342 1 3 1 1 1 Models:…
-
1
votes0
answers39
viewsIs there a limit to subclass levels to use the Where function for query?
I am working on an internal statistical data system of my company and I came across a situation I had never seen before. I am consulting the API of a service and this returns me a JSON with many…
-
1
votes1
answer129
viewsRegex to take a stretch that may or may not occur
I have a phrase, where before and at the end of it I have {{ and }} Example: {{UMA FRASE DE EXEMPLO}} In some cases, I may have a parameter for that phrase. To identify that it has a parameter I use…
-
1
votes1
answer107
viewsHow to use Commandparameter in Xamarin.Forms?
Good afternoon. I have a button that is mounted as follows: <ImageButton Source="{local:EmbeddedImage ResourceId=CreativeAutoMobile.Midia.btnfoto.png}" BackgroundColor="#c3c3c3" WidthRequest="50"…
-
1
votes0
answers1254
viewsNo errors appear in Vscode (eg errors referencing wrong typed)
I’ve looked at everything I had and I haven’t got it yet... I am studying ASP.NET Core, with C#, and no errors appear in Visual Studio Code. Example: if I reference a class with the wrong name, it…
-
1
votes0
answers44
viewsFull Description for a flag in a List/Ienumerable in C# Asp Net MVC
I have a list of records, where I have a Status (STS_BANCO) with values (A of Active and I of Inactive, P awaiting approval, and N analyze, among others ) where in the table I recorded "A,I,N,P",…
-
1
votes1
answer31
viewsError when performing query with Linq Groupby in C#
I need to select the Groups previously registered, bringing data not repeated. However, an error is returned when performing the query in the table Point of Attendance, where the countryside Group…
-
1
votes2
answers331
viewsWhat should I return in an Httppost and Httpput in an API?
I am doing an API in . NET Core and I have a question in what I should return in the methods Httppost and Httput, as below: // POST: api/Product [HttpPost] public async Task<IActionResult>…
-
1
votes1
answer225
viewsHow to compress images in Xamarin.Forms?
I am developing an application in Xamarin.Forms that uses the camera of the mobile phone to capture images, however, depending on the client’s mobile the image can reach up to 12MB, this is too much…
-
1
votes1
answer64
viewsProblems using null coalescing
I’m having trouble using the null coalescing in the case below: When trying to use operand ?? to validate if the value reader["Data"] is void, and if the DateTime.MinValue. The error that returns…
c# asp.net-mvc asp.net-mvc-5 asp.net-core datetimeasked 4 years, 10 months ago Demetrius Pecoraro 36 -
1
votes2
answers1062
viewsAdd-Migration does not work on EF Core 3
good afternoon. When trying to generate an initial Migration to create the database structure, I get the following error: "Unable to create an Object of type 'Meudbcontext'. For the Different…
c# visual-studio asp.net-core entity-framework-core migrationsasked 4 years, 10 months ago Marcos Reis 21