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
answer1261
viewsInclude Method - MVC - working with data insertion in two tables
I have two classes: User User where Usuario possesses its id (PK) and UsuarioP owns the id (FK) of Usuario. I am working on ASP.NET MVC 4 using Fluent API. Classes are mapped within the project to…
-
3
votes4
answers5604
viewsCall function at each time interval efficiently
I have a question, I am making a game server and I need a specific function to be rotated every 10 seconds. I know there’s a Thread.Sleep() (in combination with a while(true)), but it doesn’t seem…
-
3
votes1
answer47
viewsDisable automatic refresh from a Grid
Hi, I’ve been trying to disable refresh a for a long time AjaxUpdatedControl of a RadGrid which occurs when I click on a button of this Grid. Does anyone have any suggestions on how to do this?…
-
3
votes1
answer67
viewsInlinestring vs String - what’s the difference?
In the creation of some spreadsheets with Openxml, I came to doubt the difference between: CellValues.InlineString CellValues.String There is some practical difference when inserting texts (e.g.:…
-
3
votes1
answer1485
viewsCreate tabs dynamically in excel
I am doing an MVC project and I would like to know if there is any way to create dynamic tabs in Excel according to filters and export it later. Example: If the filter only comes with "School"…
-
3
votes1
answer245
viewsHow to add image on second page with setAbsolutePosition iTextSharp C#?
I would like to know if it is possible to use the setAbsolutePosition to add an image to the second page of the document built in iTextSharp PDF. if possible, as?
-
3
votes1
answer76
viewsWhat do the following column/row measurements mean?
In creating rows or columns of WPF, which means each of these measures? <Grid.ColumnDefinitions> <ColumnDefinition Width="50"/> <ColumnDefinition Width="50*"/> <ColumnDefinition…
-
3
votes2
answers116
viewsAdd number in each row in c#
How to remove the numbering of this line and then add again in another format? Input: N0006 G90 N0007 G90 N0008 G92 X21.7301 Y88.9657 N0009 S555 N0010 D14 N0011 G42 G01 X22.0659 Y89.3015 N0012…
-
3
votes2
answers277
viewsValue of Enum C#
I have a question regarding the following code snippet: public enum TipoPessoa { [System.Xml.Serialization.XmlEnumAttribute("1")] Fisica = 1, [System.Xml.Serialization.XmlEnumAttribute("2")]…
-
3
votes2
answers3291
viewsObtain the number of decimals of one decimal
How can I get the number of decimals of a variable decimal? Ex.: If I receive the number: 4.5 - you must return 1 5.65 - you must return 2 6.997 - must return 3 I know what you can do by converting…
-
3
votes2
answers328
viewsWrite to "Command Line" by C#
Boas, I have a program, which uses the command line, but I can only get it to write "one line", and I needed it to write more than one without erasing what has already been written... What I got so…
-
3
votes3
answers721
viewsWhy isn’t onBlur being executed?
I was wanting to run a function in Javascript when the dropdown lose focus. I’m doing it this way, using onBlur, and it’s not working: function DesabilitaFiltro() { alert("ok"); } <div…
-
3
votes1
answer4502
viewsDisplay (decimal) value without rounding
Hello, using a database mysql, with Asp.net mvc c#, have in the database the following value (of decimal type): 48.205864 So when I just make one select, and bring it to the screen, is displayed…
-
3
votes1
answer449
viewsWPF Combobox - How to fill in using MVVM
I’m having doubts about how popular a WPF Combobox using the MVVM standard. Here at Stackoverflow there is a similar question to mine, however, has not been answered (I would like a brief…
-
3
votes1
answer828
viewsGetenumerator error while rendering a View
I did it just as a test: @model Operador.MVC.Models.OperadorModel @{ ViewBag.Title = "Operador"; } <table id="tblOperador" class="table table-hover table-striped" border="1" cellspacing="0"…
-
3
votes1
answer1202
viewsRDLC report in an internal project folder?
I created a system with C# and Winforms and to create my reports I created an internal folder in the project with the name of reports, in this folder I create the RDLC for display in ReportViewer…
-
3
votes1
answer2240
viewsChange the color of the Datagridview line
I would like to know how to change the color of a whole line of DataGridView. I have a code below, but it only changes the color of a specific column, and I would like it to change the color of all…
-
3
votes1
answer137
viewsProblem with installation prerequisite
I have an installer project in Visual Studio 2013. One of the prerequisites for installation is Iisexpress 7.5 or higher. I was able to put Iisexpress 7.5 as a prerequisite: However, when trying to…
-
3
votes1
answer8989
viewsHow to add an element to a list?
What is the correct syntax to call the method Add_Pessoa class ClsPessoa by a List? public class ClsPessoa { private static string PSTR_Nome = ""; private static DateTime PDT_DataNascimento; private…
-
3
votes3
answers682
viewsWhat is the difference between Smtpclient.Sendasync and Smtpclient.Send() using Thread?
What difference between using SmtpClient.SendAsync() and create threads and execute the SmtpClient.Send() for messaging? There is a lot of difference in performance or resource consumption?…
-
3
votes1
answer427
viewsHow to configure Appium using Selenium Web Driver (C#) - Visual Studio
Good afternoon, I read some blogs about setting up Appium, but I’m still a little lost. I need to set up Appium using the Selenium Web Driver in the VS (C#). Currently working with Eclipse and…
-
3
votes2
answers181
viewsReturn a similar path value
No result in my post, i would like to know how the function would be used Directory.GetFiles, to list the files and folders within it without showing the full path. Ex: public List Listar(String a){…
-
3
votes1
answer106
viewsFood list gives "Index out of range"
In my system, I need to return to the number of questions that the student missed on a particular topic. To achieve this, I tried creating a class that has two attributes: Tema and QteErros and…
-
3
votes1
answer104
viewsOR in Join using Linq
I have the following tables: Tabela1 Tabela2 Tabela3 Tabela4 +----+-----------+ +----+-----------+------+------+ +----+-----------+------+------+ +----+-----------+ | Id | Descricao | | Id |…
-
3
votes2
answers2511
viewsHow to add item in array through a foreach?
I’m doing a check in a directory where I list all items with a specific extension. And I need to add the items into one array through a foreach. Follow part of the code I’ve tried. DirectoryInfo di…
-
3
votes1
answer811
viewsIs it possible to return the child class through a method in the parent class?
I’m making a Builder and I’d like you to behave as follows: abstract class ClassePaiBuilder { public ClassePaiBuilder SetAtributo(string atributo) { // codigo return this; } public string Build() {…
-
3
votes1
answer304
viewsGenerate sequential key based on sum of digits
I have a cyclic function where a string may have any value in the checker digit, but all future submissions receive a pre-calculated value. In this role, I receive a string (which will always be a…
-
3
votes2
answers140
viewsIt is possible to save multiple values in a single database field
I declared the field in the database like this: descricao VARCHAR2(5)not null, It is possible, for example, to save 1,2,3,4 at once (a single record) in the field descricao, where each of these…
-
3
votes1
answer1055
viewsSelecting All Rows from a Datagridview
I wonder how I do to select all the Rows of a DataGridView. Code that I have: DataGridView.Rows[0].Cells[0].Value.ToString();
-
3
votes3
answers468
viewsSearch for word in the first array column
How do I search for a word in all lines, but only in the first column of a array that will always increase in size? string[,] array = new string[1,6]{{"texto","","","","",""}};…
-
3
votes1
answer124
viewsDisplay a button based on the action of another
I’m a beginner in Asp.net MVC I have a project. And within a certain view I have two buttons. However, one can only appear if the other is executed. 1 Button > Save (save car) 2 Button>…
-
3
votes1
answer61
viewsModel/View Programing - WPF and Mysql
I had already made some programs in C++ using the QT framework and its Model/View Programming(http://doc.qt.io/qt-4.8/model-view-programming.html). The concept was simple: created a template that…
-
3
votes1
answer781
viewsUndefined Object Reference for an object instance when trying to retrieve an element in an XML file
I’m making a mistake tormenting myself. Basically I am saving all equipment settings (RF Readers) in an XML file (Configs.xml). My goal is to retrieve the first element of all settings that have a…
-
3
votes1
answer83
viewsSecurity Attributes
A friend asked me how to give more security in your application, to avoid a kind of "url injection", IE, someone manually type an "addicted" url and bypass the system. Of course, there are several…
-
3
votes3
answers7584
viewsCalling the Controller Method
I’m doing a project for the College, and I’m having a hard time understanding how to create a button and call an Actionresult in the Controller, and I was wondering if the action needs to be in the…
-
3
votes1
answer117
viewsAccessing data stored in cookies?
In login, I store user information logged in to a cookie (name, password, etc...) How do I access this cookie and redeem information from it? For example, I want the name of the logged in user to…
-
3
votes2
answers958
viewsAsp.net - Prevent consecutive button clicks
Good afternoon. I have an Asp.net webform application, and am having the following problem. In a certain part of the system, the client has two buttons to navigate between the issues of a magazine,…
-
3
votes2
answers1067
viewsHow do I print to dot matrix printer on the client with a web application?
I have an application made in C# MVC with a routine to print a plain text on the standard printer. The method was used RawPrinterHelper.SendStringToPrinter that is described in this article.…
-
3
votes0
answers257
viewsNhibernate.Xmlserializers - Isn’t there?
Unable to load file or Assembly 'Nhibernate.Xmlserializers, Version=4.0.0.4000, Culture=neutral, Publickeytoken=aa95f207798dfdb4' or one of its dependencies. The system cannot find specified file.…
-
3
votes2
answers108
viewsMemory Leak in Xmlserializer
I have the code below. How the method is static and the XmlSerializer does not implement the Dispose, at each call of the method, the system stacks in memory or the GC (Garbage Collector) can clear…
c# asp.net-mvc .net memory-management garbage-collectorasked 8 years, 11 months ago Tiedt Tech 2,427 -
3
votes1
answer1118
viewsHow to convert Byte[] to Image in Xamarin MVVM?
How to convert an array of bytes for Image in Xamarin ? I am returning an image that is string type through a WebApi and with that I need to make it displayed in the component Image.…
-
3
votes1
answer78
viewsConvert a Session to Boolean - Asp.net mvc?
I have in my system a Session that stores an information "S" or "N" Session["Administrador"] = retorno.ADMINISTRADOR; In the layout I want to convert it to Boolean @{ bool administrador =…
-
3
votes1
answer1163
viewsCannot evaluate Expression because the Current thread is in a stack overflow state
You’re making that mistake: Cannot evaluate Expression because the Current thread is in a stack overflow state in the variable qtde adding it to the list desci. class descricaoo : IInstrucao {…
-
3
votes2
answers4336
viewsClear button radio button
Good morning I would like to know how to clean what was clicked on the radio button, because in the textbox I use the name. Clear(); I wonder how I do on the radio button Thank you.
-
3
votes2
answers468
viewsWhat is the corresponding timestamp variable type (SQL Server) in C#?
I have a field in the database (Seqalteracao) of type timestamp and need to map it to C# (Entity Framework). What is the corresponding type in C# for this type in the bank? public **Tipo**…
-
3
votes1
answer556
viewsFirebird C# standard Singleton
I am using the following function to connect to the database, I am programming in C# in Visual Studio 2013. namespace WindowsFormsApplication1 { static class Conexao { private static String strConn…
-
3
votes3
answers321
viewsPass List as LINQ expression parameter
I have a LINQ expression where the result is saved in the variable query, which is transformed into a list, this query returns a series of "RA attributes". I would like to pass this list of…
-
3
votes1
answer384
viewsPassing a javascript variable to Session
I wonder, how do I send a value I have in javascript to a @Session. in case it would be more or less like this: I have a variable: var id = $(Person). val(); this ID wanted to use in a session…
-
3
votes2
answers2341
viewsServer Error in '/' Application - Runtime Error - Asp.net
My application has custom errors working properly. Only when you add "/...." at the end of the URL (necessarily more than two points), the untreated error "Server Error in '/' Application". If I add…
-
3
votes3
answers1689
viewsHow to make visual form inheritance in Windows Forms?
I have a form base that will be the form 'Dad, with three buttons on it. Add, Delete and Change. I’m gonna use the formbase to standardize my registration screens, so each registration screen when…