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
answers304
viewsPick all fields of a class using Lambda + Group By
I have a list: produtosCompletos = (from f in estoques join p in produtos on f.idProduto equals p.id join c in classes on f.idClasse equals c.id select new produtoCompleto() { idUnidade =…
-
1
votes1
answer180
viewsAdd parameter using Pagedlist in logging detail and page links
Does anyone know how to keep a parameter between the various pages of Pagedlist? The situation is as follows: I used the Scope_Identity when creating a row in a table, because I did the Id of the…
-
1
votes1
answer48
viewsIf an object manipulated by a pointer is allocated in the heap, can it be collected by the Garbage Collector?
I am studying C# and I am in the pointers section. I understand that a pointer stores a memory address of an "object" (types by value and Array). The data stored by the pointer (the address) is in…
-
1
votes1
answer643
viewsI can’t get functions from the System.Management class
I am unable to call some functions of the System.Management class; for my program. I’ve tried to put using System.Management; or System.Management.ManagementObject but it also doesn’t work. Code:…
-
1
votes3
answers190
viewsRun DELETE only when you return SELECT
I have a routine where I update the local database with the data from another database. I simply execute a DELETE and then a INSERT INTO tblX (SELECT * FROM tblY (tblY is a linked table)), as below.…
-
1
votes1
answer51
viewsTest Expression as user type
I’m having problems trying to test an expression as the user type. I have a TreeList where the user will enter a code, this code has the model: XXXX-XXXX-XXX I mean, it could be anything like:…
-
1
votes0
answers71
viewsSending of Modal Multiselect data
I would like a help with this code: I am sending information from a table for modal and this table will have data of the groups separated by comma and I would like it to be selected in the modal in…
-
1
votes1
answer61
viewsC# Selenium Chrome automation, How to access an Htmlcollection using Selenium in visual studio
Well personal, I’m trying to access an index of an HTML Collection by Selenium in visual studio, only that I’m not able to access, I’m using the classname to access a certain field, and seek its…
-
1
votes1
answer414
viewsHOW TO PERFORM FUNCTION EVERY TIME PERIOD - UNITY
I need to perform this function - which creates a randomized platform in a randomized position - every 3 seconds . How does?? void CreatePlatform() { System.Random random = new System.Random(); int…
-
1
votes0
answers77
viewsCompare childnode with C# and XML variable (Xpath)
I have an xml file with several structures. I have a structure called Product who has a field ProductCode and I have a structure called SalesInvoice, inside of it I have a field Invoice, within the…
-
1
votes0
answers511
viewsReturn value in the Header of an HTTP call (POST) in the API
I’m using Postman to make the call at the API. That returns me this result in the body: that comes from this abstract class: public abstract class ResponseBase { public long SessionId { get; set; }…
-
1
votes1
answer58
viewsHelp with release of written application in Visual C#
I just finished a small project. In Visual Studio, I chose "Release" to compile and run. I did some tests and the application ran normal. One of the processes run by the application takes about ten…
-
1
votes0
answers14
viewsWhat is the difference between Marshal.Sizeof and sizeof?
What is the difference between the results of the method Marshal.SizeOf(Type) and keyword sizeof? When to use one or the other? When there are differences of results?…
-
1
votes1
answer52
viewsHow to select a random string from a list in C#?
Basically, I intended to choose a Random Question from the 'Question List', and when I write the code, it gives me an error in the bold part (the one inside the **). private void EscolhaDaPergunta()…
-
1
votes1
answer191
viewsWhat type used in Postgre to save a large currency field in the format of 000,000,000,000.00
I am developing a web application in Asp.net and need to save a monetary value in decimal format in C# and store it in postgre in Numeric format, and the value is great. It’s a need that came up in…
-
1
votes1
answer430
viewsRetrieve Ienumerable values from View
I have a table/model called Itemtabelapreco: public class ItemTabelaPreco { public string Nome { get; set; } public decimal ValorUnitario { get; set; } public int QtdPacote { get; set; } public…
-
1
votes0
answers175
viewsInsert Sequential Number into column C#
I have this table called Articlebarcode: In the column Code I need to insert a sequential number, that is, I have to read the maximum number that is there and insert the next one that is available !…
-
1
votes1
answer86
viewsHow to fill in a dynamic html form
Good evening, everyone. I have a question here, I hardly touch with web, but I needed to assemble an html file that aims to print a boleto. The project is done in C# and the html file is next to the…
-
1
votes4
answers69
viewsHow to convert fields to a line with string?
Follows the code: Model: public class Usuario { public string Campo1 { get; set; } public string Campo2 { get; set; } public string Campo3 { get; set; } public string Campo4 { get; set; } public…
c#asked 7 years, 7 months ago Matheus Miranda 5,375 -
1
votes1
answer83
viewsProcessing cost between code and database
Among the many forms of development, there was a doubt about what will consume the most of my processing between the same operation in different ways... If I have a function that can be done…
-
1
votes0
answers20
viewsRecover Ienumerable Value in Post
Good morning, I created a request for help on this before and it was marked as duplicate and some who tried to help me, but I think they misunderstood what I’m struggling with. I have these two…
-
1
votes0
answers65
views -
1
votes1
answer295
viewsHow to return several values of a class?
Follows code: Controller: public ActionResult teste1(int num1, int num2) { // Aqui quero obter os valores da variável model1 e model2 da classe MyClass var result = MyClass.Teste2(num1 , num2); }…
-
1
votes0
answers32
viewsMysql incorrect decimal value in view
I don’t know why the number 9937.77 stored in Mysql as Decimal(12.2) displays 9 million in views 1.00 displays 100 (1.00 is correct) 5.77 displays 577 (5.77 is correct) I tried to DisplayFor(m =>…
-
1
votes1
answer125
viewsHow to make Selenium click a dynamically generated button?
I need the bot to make a confirmation by clicking this button, which appears in a popup: <button class="btn btn-info" id="c2e9772d-375d-47a1-9088-da9824d2e856">Sim</button> But the…
-
1
votes1
answer53
viewsPerform action in all textboxes without having to repeat for each one (C#)
Well, I have a Windows Form program with 35 textboxes,and I want to perform the following action on all of them,: private void txtGSabado5_TextChanged(object sender, EventArgs e) { if…
-
1
votes2
answers642
viewsProblem sending file via FTP C#
I have an executable that sends a . CSV file via FTP to my client. Running on my local machine works smoothly but when runs on my client’s server does not work. Every time I fall in line…
-
1
votes1
answer124
viewsDatatable Lento
Good Afternoon, You Guys I have the routine below. I would need to streamline this routine it takes a long time to process, someone would tell me how I could do it ? The Select performed in the…
c#asked 7 years, 6 months ago Marcos muekita 7 -
1
votes1
answer120
viewsAsynchronous Method Blocking Queue
I’m using MVC and so I approached asynchronous methods for Actions in Controllers in order not to block access to other pages of the site while a long-term process is taking place. However, I have…
-
1
votes1
answer1746
viewssmtp connection error with C#(authenticated)
Below is the Script used when trying to send an error: Failure to an SSPI call. Client and Server cannot communicate because they do not have a common algorithm. string CorpoEmail = file;…
-
1
votes1
answer234
viewsError while consuming Github API V3 using Httpclient or even Httpwebrequest
I’m unable to consume the Github V3 API with basic authentication (without using Octokit). I know it works with Restsharp but I want to know why it doesn’t work with HttpClient and HttpWebRequest. I…
-
1
votes0
answers42
viewsCompatibility Android and Windows Phone encryption
I have a C# application that generates information on Windows Desktop and sends files to Android application. I send the encrypted information with the functions below, but I’m developing the same…
c#asked 7 years, 6 months ago Ricardo Souza 11 -
1
votes1
answer234
viewsWhat is and what is the difference between IIS Local and IIS Express?
What makes the "Create Virtual Directory" ?…
-
1
votes0
answers13
viewsError publishing production version on Azure
I’m trying to publish a version on Zure of a particular application and always accuses this error, before it climbed without probelmas. Running local the application works smoothly. What should I…
-
1
votes2
answers99
viewsDo not let insert same value in a Datagridview C#
I own a DataGridView where I have a column called Ramal, where the specific seller’s extension will go. How to do that when I type in a line an existing extension, appear a message that cannot be…
-
1
votes1
answer44
viewsRemove multiple protocol authentication
Hello, I am implementing the MVC with Asp.Net Identity, however, I’m having some problems... Setting: I’m logging in from protocol HTTP, everything enters normally. When I try to access any page…
-
1
votes3
answers7999
viewsUpdate Error with Entityframework
When I try to update an object in the database, I get the error, Store update, Insert, or delete statement affected an Unexpected number of Rows (0). Entities may have been modified or Deleted Since…
-
1
votes0
answers33
viewsConvert Dynamic to another type
I need to convert a Dynamic variable to another type in Runtime. The type I want to convert is stored in another variable (I don’t know what type at development time). There’s something like this?…
-
1
votes1
answer849
viewsNumber of lines in Datagridview
I have a Datagridview and I need it to show me in a textbox the total number of lines that we have Datagridview. how can I do this. Below follows my code private void ListaGrid() { string strSQL =…
-
1
votes1
answer340
viewsTo return multiple rows with sql Server byte array
I need to perform a query, in a table, where the data is of the type varbinary(max), then created the method below: public List<byte[]> preenche_fotos(string nCrm) { consql.bd_string();…
-
1
votes2
answers1605
viewsHow to configure the Connection String in App.config?
I would like to mount using saved String: InstanciaSQLServer, UserSQL and PWSQL, it is possible that? Example of my app.config <configSections> <sectionGroup name="userSettings"…
-
1
votes4
answers54
viewsDoubt about the use of the VS2015 SPA Template
I need to do a routine to send email, through a form I made, using the VS2015 SPA Template. I put two buttons, Cancel and Send. The question is not in the code of the email, but how to assign the…
-
1
votes0
answers44
viewsSql Server Function - 0 hours today to the current time
Please select the amount of hours in regression until 00:00 hours in Sql Server, always of the current day. I get this through a function like 'DATEADD'? Ex: Now it is 15:00 hrs would like to pick…
-
1
votes1
answer16
viewsHow do I deactivate @Editorfor?
I’m doing a project of CRUD in ASP NET MVC in the part of editing the information the team code is being pulled from the bank and is appearing in the @EditorFor and would like to make it so that it…
-
1
votes1
answer670
viewsFilter with Linq or Lambda using Join and Group By
Good Afternoon In a table where it is always inserted new records may occur of having the same Date and the same Ratecode, however I want to get a list of this table but for each Date group,…
-
1
votes0
answers85
viewsHow to check if pepflashplayer.dll has started and catch Pid
I’m picking up the modules that are being used by Chrome to know if pepflashplayer.dll (FLASH PLAYER) has been started I’m using that code void ListAllProcesses() { var hProcessSnap =…
-
1
votes2
answers1386
viewsAccess client-side biometric reader - ASP.NET MVC - WEBFORMS
Galley, I developed an ASP.NET MVC application, using a webforms page, which is called inside a MVC page. Because only from there I was able to load the SDK Dlls, to send requests to a biometric…
-
1
votes4
answers179
viewsCreate method that avoids code repetition in ASP.NET with SQL
I am building an ASP.NET site, using C#. I want to 'link' the site information (text and images) in an SQL Server database. This part of connection I’ve managed to do successfully. However, I have…
-
1
votes1
answer72
viewsHow to approve a model depending on another model confirmation?
How do I make for the View request only appear to the user, when the class confirmation Aprovacao for true. Follows the logic: 1- user creates the request and register, 2- user awaits confirmation…
-
1
votes2
answers321
viewsSometimes jquery does not work
I have a button on a tab that calls an API. The button lets you follow a user or stop following. Clicking on the button changes a label that is next to the button and the symbol that is on the…