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
votes2
answers981
viewsSerialization of a large list in JSON.Net
I’m having a problem to be able to serialize an object (a list of a class with approximately 5000 items). I am using JSON.NET to generate the Json string but it is getting the following problem, in…
-
3
votes1
answer533
viewsFluent Nhibernate with multiple tables
I’m using the Fluent NHibernate to assist the ORM (replacing the manually made . hbm files) with a single class: User class: public class Usuario { public virtual int Id { get; set; } public virtual…
-
3
votes3
answers2248
viewsFill string with blank boxes
I need to format a string so that it contains only 30 characters. If you are less than 30, you should complete it with blanks, and if you have more, you should leave it with only 30. I know you must…
-
3
votes2
answers3501
views -
3
votes3
answers4226
viewsPersist information using Viewbag?
I have my screen login is to show the name is id of the logged in user on another screen, so I can use this information. In my controller: [HttpPost] public ActionResult Index(TB_USUARIO model) {…
-
3
votes4
answers855
viewsDeserialize JSON
I can do the POST of this information: { "Nritem": 1, "Cdprevenda": 3, "Cdproduto": 7, "Decomplitem": "", "Descricao": "Depilação", "Dtcadastro": "2015-11-27T13:53:35.120Z", "Flsituacao": 1, "Md5":…
-
3
votes2
answers3060
viewsDelete line from a list in C#
I have a list as described below I would like to delete a line from the list mylistnova1 as condition is true. I try to do as described below but it generates error! Could you please help me? Abs.…
-
3
votes3
answers1224
viewsC# - Close Form without Stopping Application
Hello, I’m using C#, to create a login system. And I would like to know some formula to close this login window without stopping the application. I used this. Hide(); to hide the form, but when…
-
3
votes3
answers167
viewsInherited Form comes with no editing option on the whole. Use C# and VS 2017
When I create Form2 Inherited from Form1, I can’t edit anything on it. Of course the lock on the upper left has something to do with it, but how can I resolve this situation? Follow the image for…
-
3
votes3
answers5094
viewsHow to download a file from a URL using C#
Developing a C# project I came across the following situation, I need to download files from some URL’s, what is the best way to do this? Would have some way to together the download implement a…
-
3
votes1
answer85
viewsHow to generate Thumbnail using Mediatoolkit
I need to generate a thumbnail from a video when climbing it to my application, I would like an explanation of how to use the package Mediatoolkit to do this, I thank you already.…
-
3
votes2
answers176
viewsWebclient downloads a wrong string
I’m trying to create a virtual intelligence system, and hosted the language files on my FTP. These files are from a language I made myself, called SVDB, and hosted on FTP, and when I download in the…
-
3
votes1
answer194
viewsUnity 5 - Shoot up, Enemy ship does not shoot
The enemy ship simply can’t shoot and walk at the same time, or it does one or the other. public class EnemyScript : MonoBehaviour { public float speed = 5f; // Use this for initialization void…
-
3
votes1
answer429
viewsWhat is Asyncpostbacktrigger Class?
How should I wear and what makes this kind of class?
-
3
votes1
answer222
viewsC# How to send the value of the numericUpDown to the textbox in Hexadecimal?
then... the numericUpDown even has the count format in Hexadecimal, but when sending to texBox it counts only in decimal has some form of textbox to receive the Numeric given value in Hexadecimal? I…
-
3
votes1
answer1373
viewsRedirect to View in another structure
I have a project, which is in an area, in it, my Main controller, has an action that, when called, should return a view that is in another folder, however, within the same area. return…
-
3
votes1
answer224
viewsUpload in batch Asp.net MVC5
I’m trying to develop a web system that works as a message-oriented social network. Having the classes usuario.cs and Informacao.cs (which acts as a message), need to provide attachments in this…
-
3
votes1
answer535
views -
3
votes1
answer310
viewsReading of Excel file
I’m trying to use the C# to read an Excel file, but every time I run the code the last column is not stored Reading Code: //Cria conexão com a planilha OleDbConnection conexao = new…
-
3
votes1
answer71
viewsCondition optimization
A comparison is possible (if 1 or equal to null) simpler than the one made in my code? @((Model.Visibilidade == 1 || Model.Visibilidade == null) ? "checked" : "")…
-
3
votes1
answer887
viewsHow to make your program reliable - windows security
I finished a step of a program and we will start to put in production, however, when running the program is always displayed the message below: What should I do to make my program reliable? and stop…
-
3
votes1
answer756
viewsLoad updated page using method get jquery mvc Asp.net
I have a demo page where I organize a to-do list.. wanted that when it relapses it already comes updated with the tasks already posted previously <html> <head>…
-
3
votes1
answer365
viewsCreate matrix (line header) in Datagridview
Would you somehow in C# use this pointed column of the image to add value to it as if it were a "header"? I’m using the DataGridView below to show an array. The matrix header is already being shown…
-
3
votes2
answers35
viewsNotsupportedexception error when setting value to a Datasource
I have a textbox and want, when typing something, the datasource of my gridFornecedor be updated. I’m using the code below: private void txtNome_TextChanged(object sender, EventArgs e) {…
c#asked 7 years, 6 months ago Italo Rodrigo 4,344 -
3
votes1
answer268
viewsMove image to HTML via Viewbag
I have an image in an array of bytes, and I need to insert it in view. Is there any way I can do this through ViewBag?
-
3
votes1
answer351
viewsHow to use inheritance and polymorphism when passing a JSON to a MVC C#Controller?
I have a MVC method that takes a client class as a parameter: public async Task<ActionResult> Cadastrar(cliente model) { } Turns out this class has two kids, a class called a person. and…
-
3
votes1
answer1168
viewsLock keyboard and mouse in C#, but keeping the execution of a method
I need to block the use of keyboard and mouse in form while it will perform a certain function of the system, on which I am placing the call of the blocking method in the event of Load of the form,…
-
3
votes2
answers140
viewsDirectories in c#
I have several. Sql files in this directory: C:\Users\anacarvalho\Desktop\Teste how do I get all these files?
c#asked 7 years, 5 months ago Ana Carvalho 389 -
3
votes1
answer256
viewsInsert the value of an attribute into a textbox
I need to enter the value of the attribute SALDO class Conta in a TextBox. In java resgato via method get and convert with parse.float and Seto as string in the field. In C# as executed?…
-
3
votes1
answer221
viewsLinq - Searching for objects that have a predetermined list
I have an entity from Many-to-Many, many students for many subjects. And I need to get all students who possess all the subjects I desire. For example, subjects: Mathematics, Portuguese and Physics.…
-
3
votes2
answers154
viewsFind out if particular control is a button
I have the following code that serves to change the color of the buttons that are in a panel: private void mudaCorBotao(Button bt) { foreach(Control b in Panel_esq.Controls) { if (/*[O que devo…
-
3
votes0
answers533
viewsIIS configuration to authenticate using Active Directory
I created a web system using C# and use a routine to authenticate the user by taking the Active Directory user. However my system is not getting the AD user: it is catching the user from pool of the…
-
3
votes3
answers3072
viewsProvide file download from server
There is a feature of registering a customer’s data. The user selects a file from his computer, and this file is imported to the server in a separate folder, and this file can be a PDF, JPEG, PNG.…
-
3
votes2
answers254
viewsSIT tones using Python or C#
Hello, I’m making an app that detects SIT tones (https://en.wikipedia.org/wiki/Special_information_tones). I understand very little the mathematics involved in Fourier transforms and signal…
-
3
votes1
answer66
viewsHow to find out in which generation of Garbage Telescope an object is allocated?
Considering my previous question on the generations of the CG, would like to understand if considering the "moment" through which an object is passing within its life cycle, brings some benefit or…
-
3
votes2
answers1359
viewsSpecified conversion is not valid in Executescalar
The specified conversion error is not valid happens in the code: if (command.ExecuteScalar() == DBNull.Value) { resultados[j2][i2] = 0; } else { resultados[j2][i2] =…
-
3
votes1
answer45
viewsHow can I read custom Attributes without using reflection?
I have the following code snippet: [Campo(Chave=true)] public System.Guid EscalaId { get; set; } I know I can read these tributes using class MemberInfo, as it says example in the documentation:…
c#asked 7 years, 5 months ago Artur Trapp 5,175 -
3
votes3
answers96
viewsCapture Textbox that called the event
I want to implement the wind GotFocus in a TextBox, so that when, he gets the focus, he sets the property Text as string.empty. However, I have 6 TextBox that will run this event. How do I identify…
-
3
votes2
answers80
viewsInserting special character in view
I have an HTML table where one of your td I need to insert the following information: <td>@item.OrderSend º</td> I would like to insert in this way: <td>@item.OrderSendº</td>…
-
3
votes1
answer5883
viewsWhat is it for and where can you use C#?
A lot of people talk too much about C#. What is the real functionality of it today? It’s serious that it can be linked with Javascript and CSS? It serves to create applications for Windows, Android…
-
3
votes1
answer486
viewsWhen are threads (Thread Pool) initialized? - C#
I have the following code: public void mainFunc() { for (int i = 0; i < 10; i++) { ThreadPool.QueueUserWorkItem(new WaitCallback(funcThread), pto); } Thread.Sleep(2000) // Thread de teste. //…
c#asked 8 years, 8 months ago João Lopes 33 -
3
votes1
answer249
viewsComplex Entity Framework Update
Good morning, I have asked a similar question, I am trying to complement this see with more information and starting from the most basic. I have the following structure: public class Artista {…
-
3
votes2
answers1037
viewsHow to close connection to Firebird database
I am doing a project in Asp.net c# web Forms framework 4.5 and I did a test connection to a Firebird database, but when closing the connection it is not closing, I used the following code to open…
-
3
votes1
answer371
viewsLambda - how to use the operator || (OR) in a . Any()
What would be the correct way to implement the line below, in Lambda? ListaDeRespostasPossiveis.Any(x => x.Nome == "respostaUm" || x.Nome == "respostaDois") I saw some examples in Stack Overflow…
-
3
votes1
answer874
viewsHow to use Curl with C#, windows Forms application
I’m trying to integrate my desktop application with an online tool (Scrumwise), but they use Curl, I’m not able to consume the Rest. curl https://api.scrumwise.com/service/api/v1/getData -k -u…
-
3
votes1
answer93
viewsDbentityentry.State vs Dbpropertyentry.Ismodified
I have a question about these two ways to specify whether an entity has been modified. I usually use DbEntityEntry.State with the EntityState.Modified when I make a very big change in model and I…
-
3
votes2
answers155
viewsObservablecollection does not Binding
I have the following situation: I make the instance of a property observable in the constructor: public ObservableCollection<Model.OSModel> _os { get; private set; } public…
-
3
votes2
answers1790
viewsData Search with Entity Framework
I have a project in Asp.Net MVC where I need to work with a large volume of data. To get them from the Database (Microsoft SQL Server) using Entity Framework 4 I know basically three ways: first…
-
3
votes2
answers211
viewsWhat value is verified in a condition operation with value assignment to a variable?
I have a method that does a check and return of this method stored in a type variable bool. When I perform this operation C# tests the value of the variable or the return value of the method?…
-
3
votes1
answer1680
viewsC# SELENIUM - How to read elements of a web page by keyword mention
I’m creating a bot that searches a word in google and writes in a txt file all links found in the search I am currently trying to find a keyword on the search result page, store the links that…