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
votes0
answers29
viewsLink test case result to only one test case
Hello! I’m automating test cases with Visual Studio and studying the possibility of associating these automations with test cases in TFS. The problem is that I can associate only one test case for…
-
1
votes1
answer548
viewsCheck whether double variable is empty or numeric
How can I check if the variable a, b or c were not informed, and if in case they were not informed return all the code ? How can I also check if the letter "x" for the variable was entered in the…
-
1
votes2
answers438
viewsBubblesort random numbers
The numbers are generated randomly in the vector, but when I call the function Bublle to sort the result returns 0. Someone can help me???? using System; namespace BubbleSort_CSharp { class Program…
-
1
votes0
answers89
viewsError while running Xamarin project in visual Studio 2015
When I try to run my project Xaramin the following is reported error: Severity Code Description Project File Line Column Suppression State Error Exception while loading assemblies:…
-
1
votes1
answer1544
viewsThe process cannot access the file because it is being used by another process
The problem appears in the penultimate line of the code below, what can I do? NOTE: I have already tried to use "Using" in the Streamreader, but it has not solved. string CJ; string CJ1; string CJ2;…
c#asked 8 years ago Carlos Daniel 11 -
1
votes1
answer72
viewsHow does Backgroundworker e.error work?
I am creating an application that makes multiple connections simultaneously. For each connection I create one TextBox and a BackgroundWorker. When executing the DoWork of BackgroundWorker I use…
-
1
votes0
answers269
viewsHow to link image on canvas with an object
I have the following class: class Sapo { private Image imgSapo; public int IdSapo { get; } public Sapo(int id) { imgSapo = new Image(); IdSapo = id; } public Image show { get { imgSapo.Source = new…
-
1
votes0
answers34
viewsApplication . Net losing reference
Good afternoon. I have a web application developed in c# that uses connection to the Mysql database. I added the reference, the codebehind recognizes the Mysql reference without problems. Only when…
-
1
votes0
answers563
viewsSet Fixed Port for Projected Web API Asp.net Core C#
I would like to know how to set up a standard fixed port for my Web API application on Asp.net core.
c# asp.net-mvc asp.net asp.net-core asp.net-core-web-apiasked 6 years, 3 months ago Nicola Bogar 123 -
1
votes1
answer174
viewsLoading Renderaction within _Layout
How do I load data from a model inside in my _Layout? I have a standard layout for all views of my project where in this layout lies the div where is the user photo that is in my application at the…
-
1
votes1
answer104
viewsHow to block a file temporarily?
I’m trying like this: OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.ShowDialog(); string filePath = openFileDialog.FileName; Process processo = Process.Start(filePath);…
c#asked 8 years ago Ícaro Dantas 1,088 -
1
votes1
answer400
viewsHow to receive a form with file and form in controller ? C #
So I get the form: public JsonResult Import(**FormCollection** form) So I get the file: public JsonResult Import(**HttpPostedFileBase** file) $.ajax({ url: urlImport, method: 'post', data: new…
-
1
votes0
answers22
viewsPass interface to Signalr Hub
Is there any way to pass an interface as a parameter in the hub constructor? For some operations, you needed to access repository layer methods through interfaces in the hub. Is there any way to…
-
1
votes1
answer69
viewsSubmit ITEXTSHARP Report in a Form
How to submit the itextsharp report in a form? No need to save it in PDF. Just display it in a form. The same way we can do in reportviewer.
-
1
votes0
answers361
viewsCalling a DLL . NET C# method from a Classic ASP application
I have a web system in ASP that does the storage management (WMS). The system works and is already in use in some companies. Recently there was the need to work with labels that will be pasted in…
-
1
votes0
answers208
viewsASP.NET MVC + Checkbox how to proceed?
I have a list where I register FOOTBALL TEAMS in CHAMPIONSHIPS, I mean, I need to select several teams for a championship, I make a list with checkbox but do not know how to proceed later:…
-
1
votes1
answer88
viewsRequest performance using Html.Beginform versus jQuery AJAX
There is some performance gain when using jQuery to perform ajax requests relative to the post using Html.Beginform? @using (Html.BeginForm("Create", "Teste") { @Html.AntiForgeryToken()…
-
1
votes1
answer189
viewsLINQ to SQL - Exception when giving sum() in a query that contains another subquery using LINQ
private decimal GetBankAccountCashierTotal() { var company = _context.Company.FirstOrDefault(); return _context.PersonBankAgencyAccount .Where(p => p.PersonID.Equals(company.PersonID)) .Where(c…
-
1
votes1
answer50
viewsError loading CREATE page
I have two related methods. Patrimonio and Categoria: [Table("Patrimonios")] public class Patrimonio { [Key] public Guid PatrimonioId { get; set; } public Guid CategoriaId { get; set; } [Required]…
-
1
votes1
answer426
viewsJquery Maskmoney Asp.net Mvc
I use the Jquery MaskMoney in my inputs to treat the decimais, so far so good, but I noticed that when I type values above 1,000.00 where the MaskMoney plays me the point(.) in value, When I save…
-
1
votes0
answers20
viewsError uploading with Firebasestorage.net with Xamarin
I developed the following routine to upload images. var task = new FirebaseStorage("xxxxxx.appspot.com") .Child("data") .Child("random") .Child("file.png") .PutAsync(img); When I try to send I get…
-
1
votes1
answer100
viewsNested for conversion to threads
I got the following for nested throughout the length of an image bitmap in C#. I would like to rotate the second one with threads to be executed in parallel. Bitmap alterado = new…
-
1
votes1
answer443
viewsFill a list with Json return
I wanted to fill in a textarea or anything that looks like a list, with the items that the guy selects from a dropdow. So I thought so, but I don’t know how to feed the list... <textarea cols="1"…
-
1
votes1
answer433
viewsCreate a new instance every time you use Navigationpage in Xamarin Forms?
Let’s assume that I have 3 screens in Xaml and I use the SterDetailPage and Navigationpage to navigate between these screens back and forth. Page A -> Page B -> Page C -> ... I use…
-
1
votes1
answer308
viewsHelp with Datatable Server-side
Hi wanted to know the best way to create a Datatable Server-side. Some questions I have: The next button doesn’t work, and the record counter doesn’t work. How do I tidy up? I am using Start and…
-
1
votes1
answer386
viewsEntity Framework 6: Select Error
I’m having problems with Entity Framework 6 with Code First. The operations of "Select" give error and EF6 does not specify the exception, as shown below: Error message: An exception was triggered…
-
1
votes1
answer512
viewsMenu Icon change color by hovering over WPF c#
Hello, I’m trying to get that when pass the mouse change color. Menu icon should be white as the letter (header) as shown in the image down below: My menu code and that <Menu…
-
1
votes1
answer179
viewsAJAX request for WCF with POST
How to make an AJAX request for a WCF service using POST? I am getting several errors with OPTIONS and POST methods that comes in the same request. Here is my code: Contract [OperationContract]…
-
1
votes1
answer55
viewsConversion of a LINQ query into methods
The following query in LINQ (with query) below is used to list all vendors that have an account (relationship 1 to 1): from f in fornecedores join c in contas on f.ID equals c.FornecedorID select f…
-
1
votes1
answer401
views -
1
votes0
answers82
viewsCode maintenance
I have an application that makes the deserialization of an XML file. I managed a class with from an XSD with XSD.EXE For deserialization I use the following code: static T…
-
1
votes0
answers1486
viewsExtract HTML from Inspect Widget
Using Htmlagilitypack, I use the following code to get the HTML of a website: var url = "teste.com"; var web = new HtmlWeb(); var doc = web.Load(url); However the data (a table) I want to extract…
-
1
votes1
answer94
viewsString in expression Entity C#
I need to make a dynamic query similar to the example below String tabela = "NomeTabela"; Var x = db.("NomeTabela").ToList(); Something like this where the table name will change according to the…
-
1
votes1
answer712
viewsHow to resolve reference error in Visual Studio Community 2017?
I want to solve a reference error when I click on a word. I used visual studio 2013 and had the "resove > reference". But in the visual studio 2017 community how can I resolve all reference…
-
1
votes2
answers7642
viewsHow to store information from a SELECT in variables
Good evening community,I have a stock program that I am finalizing and I want to do a validation for him to always check if he has enough of that product before adding to the sale. For this I used a…
-
1
votes1
answer452
viewsKnow the size of each element of a list
Assuming I have one List<byte[]> Imagens; and I want to know if any element on that list has more than 1 mega, I could do it via foreach, checking item by item: foreach (var item in Imagens)…
-
1
votes1
answer955
viewsConvert string to XML
Consider the table: In the Behind code, I cannot convert a string into an xml modCamadaOperacao objModCamada = new modCamadaOperacao(); objModCamada.idCamadaOperacao = idCamada;…
c#asked 6 years, 2 months ago Igor Carreiro 1,917 -
1
votes2
answers83
viewsInsert comma after checking more than one name
foreach (var user in users) { var strTypesModel = ""; foreach (var typesModel in user.typesModel) { strTypesModel = strTypesModel + typesModel.Name; } user.TypesModelAggregate = strTypesModel; } I…
-
1
votes2
answers78
viewsConvert SQL to LINQ C#
how do I convert the last line of this SQL to LINQ? SELECT* FROM ACOMPANHAMENTO A, PRESOS_ACOMPANHAMENTO PA, PRESOSS P WHERE P.ID_PRESOS = 300 AND PA.ID_PRESOS = P.ID_PRESOS AND A.ID_Acomp =…
-
1
votes1
answer723
viewsGet Return of Procedure on Oracle
I need to run a database (Oracle) that returns me a character (S or N), I’m using the ODP.NET driver, I tried everything and could not do it, including I looked at several answers right here in S.O…
-
1
votes1
answer114
viewsMake Join of 3 lists in c# from queries in the database
I am making a page to generate a report. In this I make 3 selects different, putting the result of each query in a list: public IEnumerable<RelatorioVencerVencidos>…
c#asked 7 years, 11 months ago Renan Carvalho 117 -
1
votes0
answers36
viewsForeign key transaction in C# and Entity-
Guys, in my application I have the Context class that has the Dbset of Shopping and Dbset of Products. It turns out that in my BD table, Shopping has a FK that picks up the Product ID in the column…
-
1
votes0
answers200
viewsPagination problem X.Pagedlist
I am trying to implement X.Pagedlist pagination, but on this line: @Html.PagedListPager(Model, pagina => Url.Action( "Index", new { pagina, search = ViewBag.Busca })) I’m getting the following…
-
1
votes0
answers94
viewsMeaning til before the name of a Class in the class body
I really don’t understand certain things. For example, what does this mean: **~TesteGeral();** public class TesteGeral : IDisposable { public TesteGeral(){string teste, string user } ~TesteGeral();…
-
1
votes0
answers38
viewsParallel vs Tasks vs Threads
I was doing a Consoleapp and I was left with a doubt, what is the big difference of each of these and what are the advantages and disadvantages? In which case I would use Parallel, in which case I…
-
1
votes1
answer219
viewsProblem in wpf datagrid control display
I am facing two problems with wpf datagrid control. The first: I have the main form, where some data is displayed, and the other where the data is inserted. When I click to enter the data and the…
-
1
votes3
answers712
viewsCompare string to Enum, inside the lambda?
the problem is: I have a dropdownlist loaded from an Enum, which can come with the null value of the screen. listaItensSolicitados = os.Site == null ? this.itemSolicitadoService.Consultar(o =>…
-
1
votes2
answers220
viewsHow to pass an attribute of the child class through the constructor to the mother class
I have 3 classes Mother class: Animal Child Classes: Dog and Cat I want to save the name attribute only when one of the objects is instantiated Gato or Cachorro. In the mother class I have the…
-
1
votes2
answers150
viewsHow to configure custom Error 500 page?
Good afternoon, I’m starting to write mistakes. In my web config is installed as follows: Error 404 <customErrors mode="On" defaultRedirect="~/Erro/Error-404.html"> <error statusCode="404"…
-
1
votes0
answers61
viewsASP.NET Button only executes the method when clicked several times
Hi, I’m facing a very annoying problem because I have a page function to cancel the weigh-in. Weighing because this page is an application that works internally by communicating with a scale over…