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
-
3
votes1
answer2694
viewsConnection to the database with App.config
How to establish a connection to the Northwind database using App.config and ADO.NET?
-
3
votes1
answer445
viewsWhat’s the best way to sync desktop app data with webapi?
I have my desktop application that needs to send data (just send) to a webapi, this data cannot be sent repeatedly and also after sent, not send again, the desktop app will be on. net(wpf) the…
-
3
votes2
answers497
viewsIs there any other way than with HQL, to bulk update with Nhibernate?
I need to do a routine that will set one flag in several records that meet some requirements, and would like to keep this in control of the Nhibernate. However, I couldn’t find any way to do a mass…
-
3
votes4
answers671
viewsCan I use Repository to do the BLL part?
I was reading about Repository vs Dao and I saw the following sentence: [...] The Repository standard aims to support the Domain model providing persistence. Unlike DAO, which is an object of…
-
3
votes2
answers4935
viewsSort List by decreasing values
I have an object Chromosome: public List<int> Rotas { get; set; } public int ValorFitness { get; set; } And I also have a list of that object List<Cromossomo>. I’d like to sort this list…
-
3
votes1
answer56
viewsGuidance control
I set the orientation of a page of my app as landscape, but it was static. If the user turns the screen 180º continues as a landscape but stays upside-down. How do I so that when the device is…
-
3
votes2
answers1100
viewsLDAP and AD - Error adding user to group with C#
I am trying to add a user to the group, but I am returned the following error: Message: The server is reluctant to process the request. Errorcode: -2147016651 Extendederror: 1359…
-
3
votes2
answers8812
viewsHow to take the value of a Listbox from the selected index of another Listbox?
I’m trying to get the value of a ListBox from the selected index of another ListBox, but it doesn’t work. What I have so far: for (int i = 0; i < 10; i++) { Lst_ListBoxA.Add(2 * (3 * i) * 4);…
-
3
votes3
answers3136
viewsGenerate 32 character MD5 password with Cryptsharp
I am using the Cryptsharp library to generate password in MD5. I had read that MD5 generates string with hexadecimals of 32 characters but is generating 34 and with several types of characters. It’s…
-
3
votes1
answer1347
views"Invalid Data" error when trying to decrypt a file using Tripledes
I am developing a routine that decrypts information from a ". txt" document using Tripledes. But when decrypting it generates the following error: Invalid data. Stacktrace is like this: in…
-
3
votes1
answer85
viewsMake a project with web Api c# return an RSS
I’m needing to get my project in Rest WEB API to return RSS instead of json or XML ... I’d like to see if anyone has already done it ?
-
3
votes1
answer401
viewsWindowsphone - How does one event "inside" another?
I defined the visibility of my combobox as Collapsed, for visual reasons and since Appbarbutton is more presentable. I want to know if it is possible to call the combobox event by firing an…
-
3
votes2
answers728
viewsSimultaneous client side and server side requests
When using Ajax, I create an asynchronous request for my server. If I use N ajax requests simultaneously, I’m still handling these requests synchronously on the server? If yes, to create an…
-
3
votes1
answer54
viewsEmbedded font with compound name is not displayed
I am embedding some fonts in my WPF application but some are not displayed. Fonts are in the /Fonts folder at the application root and their properties are set to Resource. Use like this:…
-
3
votes1
answer1373
viewsGet Headertext from a column in a Gridview
Going through the event RowDataBound of a GridView I intend to obtain the value of headertext column but I’m not getting. An example I want to get: if (e.Row.RowType.ToString().Equals("Header")) { }…
-
3
votes1
answer82
viewsDoubt about performance in using the statement
Which of the two ways to verify if a record of such TYPE has ever been registered is more performative? Are there differences, errors? What are the implications? The block using frees only…
-
3
votes1
answer2578
viewsHow to request client IIS 7.5 ssl certificate
How to request the client’s SSL certificate in an ASP.NET MVC 5 application? I enabled SSL on my site using IIS 7.5 but it tries to authenticate the user using the customer certificate but I don’t…
-
3
votes2
answers136
viewsDevexpress spin - Culture info
I’m using the devexpress spinedit, with MVC, it’s a decimal field, but I need the number score to be a point and not a comma, I need to put its culture as "en-US", how to do?
-
3
votes1
answer695
viewsError when calculating date difference in Entity with Linq to Entities
Before I was like this my expression: var resultado = db.T_CRM_StatusPDV .Join(db.T_PDV, t1 => t1.DE_Cnpj, t2 => t2.CNPJ, (t1, t2) => new { t1, t2}) .Where(dt =>…
-
3
votes2
answers1034
viewsLog in with network user
When opening the page I am building, the user who is logged in by the network, he or she will login to the page with this user, but without having to open a page for this, that is, my system will…
-
3
votes2
answers2093
viewsSend file from one server to another
The application is on an X server. From a precise upload file the file is sent to a Y server. However, I can’t find any solution for this. The application is in MVC Asp net. To upload the file to…
-
3
votes3
answers109
viewsHow to test Entity Framework performance?
I want to create mapping with heritage Person -> Customers, etc But I would like to test performance with the 3 types of mapping( TPH,TPT,TPC) How do I do it? Someone has had the experience to…
-
3
votes6
answers15655
viewsClear a datagridview in C#
I tried all this already and nothing has worked. Everyone is deleting the lines and column. What I need is to clear the content written on them. datagridview.datasource=null;…
-
3
votes1
answer1261
viewsMap associative tables in the Entity
This has already happened. When I use an associative table in Entity, these tables usually don’t have PK. When this happens, I can’t map them. How can I map this type of table?
-
3
votes1
answer78
viewsHow It Fires Vibration in My Device
How Vibrator fires in my Windows Phone 8.1 app ? For example : if(==0) { VIBRAR APARELHO; }
-
3
votes1
answer256
viewsIs it possible to leave the <Summary> in English?
It is possible to leave in Portuguese the tips of <summary> methods existing in . NET or third-party components in Visual Studio?
-
3
votes1
answer253
viewsHow to convert lambda to Expression Trees format?
How to convert that lambda: Set.Asqueryable(). Where(profile => profile.CostCenters.Select(Costcentre => Costcentre.Id). Any(Id => Ids.Contains(Id))).Tolist() Actually I managed to do even…
-
3
votes1
answer5312
viewsC# Socket Refusing Public Connection
I am using the server and client example below to make a TCP connection via internet and in the client returns the following message: Additional information: No connection could be made because the…
-
3
votes1
answer419
viewsDoubt about static methods and classes
I have a question about methods and static classes, given the code below: static List<MaterialRCM> mr = new List<MaterialRCM>(); [Authorize] public void AddMaterial(int Qtd, int Id) {…
-
3
votes1
answer1774
viewsHow to group by 2 properties and sum the values
I have no idea how to do this consultation on LINQ. How can I from sales list. Separate the sales per hour, then group the products and add up the quantities sold? public class Venda { public int Id…
-
3
votes1
answer175
viewsGridview inheriting properties
In all my grid s I have to define many properties, I wonder if there is any way to define the properties only at one time in a single place. Grid example:…
-
3
votes2
answers907
viewsHow to count . xls / . xlsx files in folder with C#?
I have a Folderbrowserdialog and when I select the folder it shows the amount files (all, no filter). How do I do this length only with Excel files (.xls, . xlsx). Follow the code below:…
-
3
votes2
answers1405
viewsString Connection excel . xls . xlsx C#
I have a connection string with excel, but it is only the . xlsx and is giving this error Serverversion = 'connExcel.Serverversion' threw an Exception of type 'System.Invalidoperationexception' I…
-
3
votes1
answer2295
viewsMultiple files for upload
I’m looking for a plugin Jquery upload multiple files at the same time. Does anyone know of any to inform me?
-
3
votes1
answer4108
viewsDoubts about column formatting in gridView
Hi, I have some questions about formatting the columns in a gridview, I have a gridView that is populated by data coming from a table in the database, the columns and row are generated…
-
3
votes1
answer394
viewsHow to make object design control faster in a C#form
In a form, in C# for desktop, there are constant movements of certain controls. In this case I am using objects of type Picturebox, however its rendering is very time consuming. Is it recommended to…
-
3
votes1
answer537
viewsHow not to serialize some attributes in Restful calls (C# + WCF + JSON)?
In the example below, how to do not serialize an attribute. I believe I’m looking for the equivalent of java syntax: For classes: @Jsonignoreproperties(ignoreUnknown = true); For attributes:…
-
3
votes1
answer1021
viewsSelect [with aggregated functions] group by in Lambda
How do I convert the following select SELECT TOP (60) COUNT(*) AS QTD, SUM(Duration) AS Total, AVG(Duration) AS Media, MIN(Duration) AS Menor, LEFT(TextData, 80) AS TextData FROM Traces WITH…
-
3
votes1
answer1236
viewsIdentify Area, Controller, and View Action
I need to create an Htmlhelper (MVC 4, C#) that identifies and tells what is the Area, Controller and Action of a View. I’m not getting anything. How can this be done? Is there a function or method…
-
3
votes1
answer524
viewsError sending file via Postasjsonasync method in Asp.Net MVC
In my Controller of a project Asp.net MVC I get from View a picture like HttpPostedFileBase and need to send to Web Api using PostAsJsonAsync: var response = await…
-
3
votes1
answer631
viewsODBC does not support reading DBF file?
I’m trying to read a file .dbf following a tutorial I saw on the site of Macoratti (Obs. I think everyone knows). And when executing the method below, is launched a OdbcException with the following…
-
3
votes2
answers9326
viewsHow to read the data of a.xml file and display in a textbox
I have an application that generates an XML file, but I’m not able to read the XML file and insert it in Textbox. <?xml version="1.0"?> <parametros> <banco>rango</banco>…
-
3
votes2
answers149
viewsInclude Entityframework
I am working with Entity Framework 6, I have made all the necessary settings. I have a Class Person that owns a Property of the Address Type, within address I have a property Municipality that…
-
3
votes1
answer836
viewsMapping one-to-Many entity with Fluent API
I have two classes, as an example below: public class Foo { public virtual int Chave {get; set;} public virtual List<Bar> Bar {get; set;} } public class Bar { public virtual int Chave {get;…
-
3
votes3
answers2450
viewsRemove list item based on property value
I have a list of objects, objects have the following properties public class oItem { public decimal nit_codit { get; set; } ... etc } So I have the list of objects List<oItem> PlItens = new…
c#asked 9 years, 11 months ago William de Castro 83 -
3
votes1
answer383
viewsError in relation statement 1 to 1 in EF with code-first and attributes!
I have the following classes where I want to make a relationship 1 to 1: User: [Table("Usuario")] public class Usuario { [Key] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id {…
-
3
votes1
answer121
views"untrusted Domain" error when trying to connect to the database
While trying to connect to database, I get the following error: Login failed. The login is from an untrusted Domain and cannot be used with Windows Authentication. I’m using MVC 5 and below follows…
-
3
votes2
answers133
viewsLoop Loop C# Asp components
You’d have to do a loop loop in this case? PaperBLL paperBLL = new PaperBLL(); List<PaperEO> papers = paperBLL.SelectPapers(); HyperLink1.ImageUrl =…
-
3
votes2
answers217
viewsProblems with date format
I am developing a system using C# MVC and Jquery UI and at the moment I am having problems with date formats, in inputs is the date in the correct format "dd/mm/yyyy" but the server is receiving the…
-
3
votes3
answers936
viewsHTML Helpers in ASP.NET MVC 4
I saw some HTML Helpers like this: @Html.LabelFor(x => x) and @Html.LabelFor(model => model.Propriedade), however, I do not understand this parameter that I must pass, x => x, what is this?…