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
votes2
answers1870
viewsHow to pass input value via post on Asp.net core Razor
I would like to know how to pass the entered value in an input to a Post method in Pagemodel. In cshtml: <div class="col-sm-6"> <label asp-for="Tickets.Identificador"…
-
1
votes0
answers27
viewsProblem with android agenda
I’m starting an interview to get a contact in the contact list: if (AceitouContacts) { Intent intent = new Intent(Intent.ActionPick, ContactsContract.CommonDataKinds.Phone.ContentUri);…
-
1
votes1
answer61
views"Dynamic" data type is not the same as native data type
I’m trying to create a struct that has one of its attributes having its type of dynamic or varied data, I need ( when running the struct constructor) to be defined the data type of it, and it should…
-
1
votes1
answer1175
viewsHow to insert literal double quote without the string " becoming "?
I work with a seeker called Lucene.net nothing more than a search engine. I need to insert the following phrases inside the indexer separated by ;: "bedside Lamp";"Lampshade";"table Lamp" Double…
-
1
votes1
answer52
viewsHow to copy the summary of a method with Overload in C#
I’m creating an application where in the classes I have a series of Overload's to optimise its performance and flexibility. Ex: public class Calc { // método original com sumário /// <summary>…
-
1
votes0
answers28
viewsPaging with checkboxes on the grid loaded with Linq
On my page there is a grid with pagination. It has fields to be checked that cannot be lost when there is paging, however my grid is being loaded by Linq. I tried to do it this way but it didn’t…
-
1
votes1
answer85
viewsCan I use a variable to set a path in Filestream?
I have a test script in Selenium Webdriver using C# in which I read data from a file .txt external. The path to the file is fixed in the script, indicating a folder on my computer. But in the future…
-
1
votes1
answer140
viewshttppostedfilebase always empty when passing csv to controller
Boa Tarde Personal, I’m having trouble passing a csv that is being sent from ajax using jquery to the controller where null always arrives. Could you help me? View : @using…
-
1
votes0
answers44
viewsConsume an asmx service from a Rest
How do I pass an object I have in a REST for a ASMX? I have this controller in REST that has the object(client) that I want to send to a ASMX [Route("api/[controller]")] public class…
-
1
votes1
answer159
viewshttppostedfilebase - Bringing null when I have many files with the big name
Good morning Next friends I have a web system mvc with c# and need to upload several files simultaneously. Until then, all right, but when the files have a big problem name I will exemplify. I have…
-
1
votes1
answer88
viewsError when searching large amount of data in Entity framework,
I am putting together a report, and in it there is the option to consult by date period. When I consult with the interval of 30 or 60 days, I can obtain the data, where I group and return. However,…
-
1
votes1
answer132
viewsSQL command blocking controller requests in C# MVC
I am implementing in a C# MVC project, a routine to run the database Store. I’m having trouble that when I start doing the Store, other requests controllers are locked, waiting for SQL to finish.…
-
1
votes0
answers432
viewsChild form is in front of everything including other windows Windows Forms C#
I need my child Forms to stand in front of the parent form, up to there blz. Only they stand on top of any other window or program. I wonder if there are ways the child Forms stay only in front of…
-
1
votes2
answers452
viewsLINQ (LAMBDA) How do I add another list of objects to my Where? c#
Good afternoon, I’m running a C# Net Core application, using lambda for database context handling. I have one question, and that is: I have a list of objects with these two attributes: Name and…
-
1
votes0
answers32
viewsGhost object in WPF C#
I’m developing an application that displays an informative track in WPF C#, I’ve already developed it with Windows Form C#, and I’m wanting to apply an event I believe, that makes this track a kind…
-
1
votes2
answers661
viewsBack to previous page - mvc page Razor
I’m trying to get back to the previous page this way: string urlAnterior = Request.Headers["Referer"].ToString(); if (urlAnterior.Contains("Pagina")) return RedirectToAction(""); else return…
-
1
votes2
answers144
viewsHow to treat an empty entry?
I have 4 text entries and a button: <Entry x:Name="Densidade" Keyboard="Numeric"/> <Entry x:Name="Volume" Keyboard="Numeric"/> <Entry x:Name="Area" Keyboard="Numeric"/> <Entry…
-
1
votes1
answer459
viewsCreating a C#Client-Server architecture
I made a test application in N layers (access to Database, presentation, business (model) and transfer objects) worked quietly and learned a lot about 3 layers and N layers. Now I’m willing to do a…
-
1
votes1
answer357
viewsConsuming a WEB API in Visual Studio
I created a WEB API on Asp.net that is hosted on a web server. This WEB API accesses a table in SQL Server where I have a table called Products with Id, name, description and Price, I ran the tests…
-
1
votes0
answers76
viewsHow to call a precedent using an oracle out-type course with C#
I’m taking a test to figure out how to make a call from a trial that has this kind of course In the past I have this: create or replace PROCEDURE "PTESTE" ( pcd_servicoagendado integer, ptipo…
-
1
votes2
answers247
viewsHow to use values from each entry in Xamarin?
The code at the moment is like this, I am doing all the visual part in the Behind code even, without implementing anything directly in XAML. I create the number of Entries according to the value…
-
1
votes1
answer177
viewsSplit() problem in Mono
I’m using a platform that has multiple exercises, the Uri Online Judge, and it automatically fixes the output of the program, but it’s in Mono This is my code: string a = Console.ReadLine();…
-
1
votes1
answer75
viewsCreate a table or several in SQL Server?
I have tables in my database: Orcamento, Maquinas, Veiculos and Acessorios. I need to record the costs of each of them, for example each table will be recorded a daily cost I create a table called…
-
1
votes0
answers1274
viewsConnecting C# to SQL Server
I am trying to connect a program to the database hosted on SQL Server, but am having problems.. When the program runs, the login screen is the first to appear, and from it I need to open the second…
-
1
votes2
answers184
viewsHow to call a parent window method when another daughter window is closed with WPF
Hello, I’m starting to work with WPF and my situation is as follows: I have a Mainwindow screen, which persists the application. The Mainwindow calls a new screen Regradetailsdialog in a certain…
-
1
votes1
answer61
viewsHow to get the value of a property with Expression?
I’m trying to get the value of a property through Expression, but I’m getting the following error. The instance property '.Rota.Applicationname' is not defined for the guy…
c#asked 6 years, 4 months ago Marco Souza 12,304 -
1
votes1
answer39
viewsMy Javascript/AJAX function is not converting Date to the correct format
Hello I’m having a problem with an MVC project. My View needs to return Data values to some Text Boxes (from the record selection by a Data Table) so that the user can do the record Edit. The…
-
1
votes1
answer133
viewsCheck/Uncheck button check box
In my program there is a button to mark and the same button to uncheck a checkbox. Example: If I click once, it marks the check box, if I click again on the button it unchecks the check box.…
-
1
votes1
answer228
viewsPick the fields of a Select and pass to viewmodel
Guys I own two Selects Multiple where their function is to change values as shown in the image below: The first in real is a Dropdownlist where he searches the bank’s information, follows its code:…
-
1
votes1
answer166
viewsCreate an extension for visual studio that adds classes dynamically
I am creating an extension for the visual studio that aims to create a project based on the options that the programmer wants. In this case a Wizard will be created where it will choose the…
-
1
votes2
answers61
viewsHow to display the values of two-class fields in a Datagridview?
I’m populating an object DataGridView with a list of type classes List<Curso>, and the way I populate the DataGridView is as follows: meuDataGridView.DataSource = cursos; But one of the fields…
-
1
votes1
answer32
viewsNullreferenceexception in C#
I’m having a problem in C#, I’m facing an exception and I can’t recognize why Details of the Exception: System.Nullreferenceexception: "Object reference not defined for an instance of an object."…
-
1
votes1
answer198
viewsRedirect Actionresult
Good for everyone. I am trying to redirect from one Actionresult to another and I have tried everything unsuccessfully. At this moment I find myself with the following code: [AllowAnonymous] public…
-
1
votes2
answers113
viewsDoubt C# ADO.NET class - Accessing data from a Datatable
Hello, good evening, I’m new here and a beginner in C programming#. I am developing a CRUD vinyl record system (a particular hahaha addiction), using ADO.NET classes, similar to the article below.…
-
1
votes2
answers534
viewsFill List with sql return
good morning How do I fill a List with a return of an sql? What I tried to do for sure will give me an outofrange Exception List<string> list = new List<string>(); string query = "select…
-
1
votes2
answers109
viewsIs it wrong to put this much code into a button click event?
It is wrong to put this amount of code in an event of click button? private void CPeBTNSalvar_Click(object sender, EventArgs e) { try { if (CPeTBCodigo.Text == "") { throw new…
-
1
votes0
answers64
viewsWrite/Readprocessmemory with offsets
I’m having doubts about how I can read/write the data from this image pointer below (Cheat Engine): My question is: How to add the module name "server.dll" + address + offsets? Code made: using…
c#asked 6 years, 4 months ago Eduardo AC 11 -
1
votes1
answer152
viewsHow to directly compare strings treated with Regex in C# directly
Hello, I come from the web (javascript) and I have the habit of working with OO mixing a little functional paradigm. Imagine the following situation. I have a CC I have to check if it exists in the…
c#asked 6 years, 4 months ago LeandroLuk 4,989 -
1
votes2
answers693
viewsFind phone numbers inside a txt file
How can I list files .txt which contains numbers of telephones in that format (99)99999-9999 cellular and (99)9999-9999 fixed ? This is the code I’ve made so far, just need to find inside the file .…
-
1
votes1
answer304
viewsEmission of NF-e 4.0: Goiás (C#/.Net)
I am updating the communication of NF-e for some customers and in general I am not having problems for authorizers like Rio Grande do Sul and São Paulo, for example. But I’m not getting Goiás to…
-
1
votes0
answers12
viewsRemoval of Event Handlers
In an application Xamarin.Android, it is important to remove the Event Handlers when leaving the screen to avoid memory consumption? It would be a good practice? For example, in the OnCreate() of…
-
1
votes3
answers162
viewsProgram to rename files
I am trying to develop a small program to rename lots of files (pdf, etc). Imagine that the default is "1250_F1_001A_E01-001A00.pdf" and at the end would get "1250_F1001A00.pdf", kept the first 7…
-
1
votes1
answer133
viewsreverse connection in C#
I’m having a hard time using a reverse connection between client and server. Whenever I try to connect using Dns or Ip does not connect, if I use Localhost, 127.0.0.1, it connects perfectly. It can…
-
1
votes0
answers36
viewsIs it possible to make a related Entity possible to display with Odata Expand (Webapi)?
Hello, I have a question regarding the following situation: I have an Entity that I defined in my model as Tasfafreq public partial class TarefaFreq { [Key] public int ID { get; set; } public string…
-
1
votes0
answers1617
viewsC# Httpwebrequest send Multipart/form-data in POST
I need to send one POST using HttpWebRequest, with the header Content-Type=multipart/form-data and Accept=multipart/form-data, and the data in Body. My routine below, I use it smoothly doing POST,…
-
1
votes1
answer438
viewsError passing parameter through Getasync method
How I pass the object login as a parameter for the method GetAsync ? I’m trying to do it this way, but I didn’t get the error message: private async Task<JsonResult> obterLogin(Login login) {…
-
1
votes1
answer861
viewsHow to list all Access table names?
Hi, I’m wanting to display the table names that are inside the Access file and play for a variable. How can I do this? Does the C# platform itself provide attributes for me to do this? I’m using the…
-
1
votes1
answer56
viewsI cannot assign a value inside my Label from a List
Good morning, first I would like to say that I am a beginner and I am in doubt when it comes to assigning a value to the property Text of a Label from a list created with information obtained from a…
c#asked 6 years, 4 months ago Gabriel Miranda 161 -
1
votes1
answer849
viewsPrevent duplicate registration with C#
I’m having a hard time with the duplicity record. How do I so that after the user fills in the form, at the time of saving, the data is compared to what is in the database, if he has any repeated…
-
1
votes3
answers160
viewsUse string to reference variable
I wish to move on to the function execSQL the name of the variable I want to use in base.consulta() and from the string SQL, directly pass the variable to the function base.consulta(), that is, pass…