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
answer294
viewsController receiving parameter array as null
I’m making an AJAX request, but I can’t pass array... My controller is like this: [Route("imoveis/BuscaDados/Json/Listas/ListaQuartos")] public JsonResult ListaQuartos(int idEstado, int idCidade,…
-
1
votes1
answer308
viewsQuery in . NET Core
I am learning the logic of MVC applied in . NET Core but I have some doubts about doing the process CRUD, more specifically the Consultation. How can I make the button click communicate with a…
-
1
votes1
answer135
viewsMap classes that inherit Id from another Entity - EF Core class
I need to map the Person and Branch classes with a one-to-one relationship, where a person will be just a branch and a branch will be tied to only one person, (A PK in Person Id and PK/FK in…
-
1
votes1
answer1544
viewsLog out and redirect user to ASP NET MVC login screen / C#
I am looking for a way to terminate my session and redirect the user to the login screen when my system der Timeout. I tried to use Session.Abandon() according to some examples I researched. But I…
-
1
votes2
answers185
viewsLosing the bar ("/")
Follows code: var token = "bHhETtde1UhKpwUVmTsNTpXZKyfZGK8/"; var token_string = Uri.EscapeDataString(token); //"bHhETtde1UhKpwUVmTsNTpXZKyfZGK8%2F" HttpResponseMessage response = await…
-
1
votes1
answer1171
viewsObject reference is not defined as an instance of an object
You’re making this mistake: error:"Object reference is not defined as an instance of an object." On this code line: public static string BDConnectionString =…
-
1
votes1
answer279
viewsHow to pass and traverse an anonymous object in a method
How can I pass an anonymous object to a method, and then traverse it? What I’m trying to do is this: public static string QueryStringToUrl(string url, Dictionary<string, string> query) { var…
-
1
votes1
answer141
viewsCS1501 C# No Overload for method takes 2 Arguments
I’m starting to venture into C#, but I’m getting the bug "CS1501 C# No Overload for method takes 2 Arguments" The code is very simple and probably contains no error, because I am using the code made…
-
1
votes1
answer33
viewsFailed to pass entity property as parameter in Mysqlcommand
I have the following code in my application: public Usuario checkLogin(Usuario entity) { //return Usuario userEntity = new Usuario(); connection = mysql.OpenConnection(); try { MySqlCommand stm =…
-
1
votes1
answer301
viewsIs coding a URL important?
Most languages have methods to encode and decode a URL, as in the case of C# System.Net.WebUtility.UrlEncode(string value) and System.Net.WebUtility.UrlDecode(string encodedValue). I realized that…
-
1
votes1
answer45
viewsError opening View with values loaded directly from class
I have a default Login screen, which has the functionality "I forgot the password", which when clicked will check the number of the user ID typed on the screen, and if respected, will open a new…
-
1
votes1
answer3199
viewsHow to return a C# error with Json Result?
I am starting now with the language C#, and I came across the following task on a system, I must do an error treatment and return this in Json Result, the returned data should be collected and sent…
-
1
votes1
answer269
viewsHow to insert/save string RTF - Aspxrichedit
In my application, I search the database for a string that contains RTF and need to load it into Aspxrichedit. And when necessary, save Aspxrichedit content to an RTF string to store in the…
-
1
votes0
answers42
views -
1
votes1
answer1018
viewsSave User Session/Cookie when logging in
In WEB applications usually on the Login screen has the option Remind me, in this application will save user data once the same leave marked the option. So when the user enters the site again,…
-
1
votes1
answer216
viewsHow to get back Json from the site Hgbrasil Weather in my application Xamarin
How do I get the values provided in the Json format in my Xamarin application. The code below is not returning anything. public class MainActivity : Activity { ProgressDialog dialog; TextView txtv1;…
-
1
votes1
answer89
viewsError when placing SUM
I’m trying to implement the SUM within those lines of code to sum the two columns Litro and TotalGasto Code: var teste = consulta.Where(i => i.DtAbastecido >= dataInicio &&…
-
1
votes1
answer156
viewsDuplicate data on datagrid
I am developing an application in WPF and when I fill the datagrid via code it returns the duplicate value. I am using Entity Framework. XAML <DataGrid x:Name="dataLocal" Margin="10,111,11,10"…
-
1
votes1
answer506
viewsXamarin: Pass data from selected item in a Listview to another Screen
How do I pass selected data from one screen to another in Xamarin? I have a Listview that receives the information from an Api and I want the user to click on the item, view this information on…
-
1
votes1
answer1690
viewsMysql net Connector and Entity Framework problem
When I install the mysql connector in version 6.9.11, I can see the driver for ADO.Net, so far so good. But when I try to create the template I get the following error: Now when I install the 6.10.6…
-
1
votes1
answer74
viewsHandle Json Format Action Return
Devs, I have a C# and ASP.NET application with an Action that returns a JSON array. When I return only a string I can deal with javascript now, when I return an array I don’t know how to handle in…
-
1
votes0
answers61
viewsRecord multiple fields 1 at a time
I need to insert a "row" instead of a table, as in the image example below: . I will fill out this form and I need to register it in the bank. However, I need it to be registered one line at a time.…
-
1
votes1
answer51
viewsCan anyone help with this message here Failed to locate or load the Registered . Net Framework Data Provider?
I created an application with Windows Forms connecting to Firebird, where on my development machine everything works perfectly, but when I put in client machine, the following error occurs:…
-
1
votes1
answer355
viewsHow to enable Migrations to Identity in Asp.net MVC
I need to decouple Identity from my Asp.net core MVC layer and play it for another crosscutting layer of my DDD project. Based on Eduardo Pires' Equinox project, I was able to do it, but I’m finding…
-
1
votes1
answer428
viewsHow to check if an XML node is null?
I have a WS which has a method in which a list of Nodes with some data is inserted. I receive this data as Xmldocument, ride the knot Parameters reading the content inside it, after that I take the…
-
1
votes2
answers555
viewsDo not update a particular EF Asp.net mvc field
I have a table that every time I create a new registration has the field Datacadastro, however when I want to edit I do not want to change the date that was registered and only changes the other…
-
1
votes1
answer843
viewsSending file via FTP in C#, URI error
I am trying to send a file via ftp using the class below: public static void EnviarArquivoFTP(string arquivo, string url, string usuario, string senha) { try { FileInfo arquivoInfo = new…
c#asked 6 years, 9 months ago Luis Fernando Consulo Martins 89 -
1
votes1
answer208
viewsASP.NET Identity - Find user by email and password
I’m using Asp.Net Identity for the first time, along with the Entity Framework, and to create a user, I do the following code: var identityUser = new IdentityUser { UserName =…
-
1
votes0
answers133
viewsEntity Code First Migrations does not find Microsoft.EntityFrameworkCore.Design
Hello, I am working on a dotnet 4.5.1 project using Entityframework with Codefirst Migrations, I have added 1 new field to an entity and I am trying to add a new Migration, but the following error…
c# asp.net-mvc .net code-first entity-framework-coreasked 6 years, 9 months ago David oliveira barbosa 11 -
1
votes1
answer936
viewsImport data from an excel spreadsheet into the Epplus-database
Gentlemen, I have the following problem: I created the code below, I made some changes, however I cannot import my file. My application is in .NET, and the database is the Oracle Sql, and adapted…
-
1
votes1
answer2080
viewsHow to change line in text file in C#?
Currently I inform in variable stringantiga the exact value to find and replace it. Is there any way to substitute for the line number instead of the exact value of stringantiga? string arquivo =…
-
1
votes1
answer144
viewsLaunch an MVC application through a Windows Service
I have an application that was developed in the DDD standard, which uses dependency injection, it works normally, however I needed to add a Windows Service type project that will start the…
-
1
votes0
answers98
viewsreturn json c# . net core sql
I’m doing a test with a console application. In it I consult the database and would like to return a file json of the result. It is possible to return the query json without instantiating the…
-
1
votes1
answer203
viewsSelect all items with same Id in the same table
Very well, I will try to be as clear as possible. I have the stock table where will have there several products -> Productoid and its Quantity. In the same table the product can be repeated with…
-
1
votes1
answer68
viewsHow to convert "Webclient" to "async/await"?
I have code that checks if you have the internet or not. public static bool InternetIsConnected() { try { using (var client = new WebClient()) { using…
c#asked 6 years, 9 months ago Matheus Miranda 5,375 -
1
votes1
answer68
viewsKeep stack trace when the method gives rethrow in the captured Exception
I ran the Visual Studio Code Analysis application and in several methods received the following message: CA2200 Rethrow to preserve stack Details 'fooBLO.Foomethod(Dadosprojectdto, string)' rethrows…
-
1
votes1
answer79
viewsNhibernate consuming a lot of memory
I have an application that connects to the database via NHibernate, with this some operations are carried out as Save, Update e Delete. However, when performing these procedures, it is incredible…
-
1
votes1
answer154
viewsModal Bootstrap and MVC C#
Guys I got a view call Projects that brings a list of projects and need to view the information/detail of each project through a modal Bootstrap. So I created a button that calls a function…
-
1
votes1
answer463
viewsHow to load Fileupload image to <Asp:Image> tag?
My question is how to load the image directly from Fileupload for the tag <asp:Image> And if it is possible to make these validations by client side and validate type and size via jQuery.…
-
1
votes1
answer114
viewsHow to Save Data Console Application using Entityframework
I made a console application using the Entity Framework, I’m just having a hard time implementing the methods of my repository class that I inherit from an interface,: public interface…
-
1
votes2
answers441
viewsError when connecting to oracle database using web programming on . net
When making attempts to connect to the bank I obtained the error according to the attached image. My application is web in . net, visual studio 2010, oracle sql database developed 3.1.07. My code…
-
1
votes1
answer62
viewsCreate Actions list with parameters and then run it
I would like to create a list of Actions with parameters and then do a foreach in this list and exit executing the methods, each with their respective parameters. Something more or less with the…
-
1
votes0
answers64
viewsError while compiling a web application
How to solve this problem? I have an application in dot.net and when compiling this message appears. I didn’t want to let this directory be default. How can I fix it? Would anyone have any idea what…
-
1
votes0
answers64
viewsChart in Asp.net
I am developing an Asp.net site where I need to upload files (.mat), and receive values in a list to plot line charts, with many points (about 200,000 points) on a single page. The issue of graphic…
-
1
votes0
answers31
viewsnhibernate oracleBulkCopy c#
According to the attached image, I have an attribute class accompanied by the method ListarMunicipio, where it has a list, in the method below I have public static void InserirOuAtualizar(Municipio…
-
1
votes0
answers3157
viewsUnable to read transport connection data: Forced cancellation of an existing connection by remote host
I am trying to make a file read in "csv" style. After reading I have to add it to the bank, however I get the following error = "Unable to read transport connection data: Forced cancellation of an…
-
1
votes1
answer121
viewsPassing a type created in Runtime for a statistical method
EDIT My problem is this. I need to generate a lambda expression that is of a type that I will only know at the time of execution, IE, the type to be used will be passed in the parameter classType of…
-
1
votes1
answer327
viewsHow to clear a @Html.Textboxfor using Javascript?
I am trying to clear the value entered in the field of TextBoxFor the following form just after Submit. @BHS_Treinamento.WebApi.Models.Curso @{ ViewBag.Title = "Cadastrar"; }…
-
1
votes1
answer1732
viewsReturn Datetime Json /Date(1519339100637)/
Good evening, I’m working with Ajax to return a json containing a data in the format Datetime but I’m getting in string format /Date(1519339100637)/. How can I convert to date and time format…
-
1
votes1
answer42
viewsRecording value of a variable in a table
I’m trying to save the data of 2 variables in a table, but when I look at the table in the database is recorded the values as 0. public void inserir(List<Conta>list) { List<Conta> lista…