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
-
2
votes2
answers34
viewsIf I return something within a using, will the resources be released?
I know that the using is used to release (give a dispose) resources. My doubt is in the following case: public void FuncNaoFazNada() { using(var acd = new AlgumaClasseIDisposable()) { return; } } In…
c#asked 8 years, 1 month ago Felipe Avelar 9,507 -
2
votes1
answer148
viewsSending post to Actionresult via knockout
Speak people, next: I’m trying to send one post using the ko, for a method ActionResult of my controller instead of a JsonResult as usual. When debugging the project it enters the ActionResult but…
-
2
votes1
answer1127
viewsSelecting Row on a Datagrid from a query. C#
Good afternoon, you guys, Someone has a code where I can select a Row in a DataGrid, from a survey ? Where I place mine Button_Click to a TextBox with a certain value, searching DataGridView, thus…
c#asked 8 years, 1 month ago Maurício Sanches 487 -
2
votes0
answers234
viewsP7s signature with C#
Guys, I have a p7s file that can hold multiple digital signatures, I managed to get the X509certificate2 class to get the last signature that was made in the file, I need to get all the signatures…
-
2
votes0
answers425
viewsHow to unify all columns Datagridview C#
I would like to join all cells(columns) of a row (Row) of a Datagridview, ie I would like to have a line without side borders in cells. Something in the style:…
-
2
votes1
answer293
viewsWhat if I want to send and receive a "package"?
I put a mini server test online and everything worked out, the problem is that I want to send integers, booleans, strings, etc... So far I only know how to send string, how to take the first steps?…
-
2
votes2
answers435
viewsConvert String with AM/PM to Datetime
I have a variable that contains a date with AM/PM: string data = "01/08/2016 9:00 PM"; When I try to convert to DateTime using the method TryParse the result ignores the designator "AM/PM". string…
-
2
votes1
answer3973
viewsIIS 7 - Error 403 Prohibited: access denied
I have a webservice restfull and when Pure on my machine with my Visual Studio it works normally, but when I publish on my production server with IIS 7 it gives a denied access error. My project is…
-
2
votes1
answer299
viewsHow to display an Enum item on my table using Angularjs?
I have a table where I make a ng-repeat, hitherto normal. <tr data-ng-repeat="item in itemsconfiguration"> <td>{{::item.Description}}</td> <td>{{::item.Order}}</td>…
-
2
votes1
answer266
viewsDoubt with Entityframework (Migration)
I’m trying to make my code run, but I’m not getting it because of this Error Severity Code Description Project File Line Error CS0311 The type…
-
2
votes2
answers297
viewsWhat are the differences between Visibility.Hidden and Visibility.Collapsed?
What are the differences between the visibilities Visibility.Hidden and Visibility.Collapsed of the WPF? There are practical or theoretical differences between set the Height and the Width of a…
-
2
votes3
answers620
viewsHow to print the amount of words in a string that gets a sentence in . NET?
I would like to print the amount of words in a sentence declared within a string. Example: string frase = "Meu carro vermelho é caro" cont = 0; aux = -1; while(frase.lenght() < frase =="") {…
-
2
votes2
answers658
viewsProblem writing data to Postgres
I have two tables in postgres (PRODUCT and CATEGORY) In the PRODUCT table I have the FIELDS -> ID, product name, description, value, Id_categoria. In the CATEGORY table I have the FIELDS ->…
-
2
votes2
answers291
viewsHow to standardize Datetime format for all type fields without using Displayfor or Editorfor in MVC?
In many cases in the application we have to use something like: @Html.Raw(item.data.ToString("dd/MM/yyyy")) can’t be DisplayFor nor EditorFor in no case and we have to show the Brazilian date…
-
2
votes1
answer49
viewsid3 display album image in mp3 file using c# mvc Razor
I’m building an application in C# and ASP.NET MVC and Razor that reads data from mp3 files, but I can’t display the album image. I have tried several available libraries, I extract all information…
-
2
votes0
answers58
viewsWhat is this error ? Disconnectedcontext
Galera blz ? I’m here programming for Windows Form with the language C# when I come across an error "Disconnectedcontext" . Well let me explain how my program works, I have several Rms in one…
-
2
votes1
answer83
viewsHow to use an enumerator like Itemsource from a Combobox?
Assuming I have the following: enum Dias {Segunda, Terça, Quarta, Quinta, Sexta, Sábado, Domingo}; How can I use the enumerator Dias as ItemSource of a ComboBox in a WPF application? For example:…
-
2
votes1
answer57
viewsProperty instantiated by Castle being recorded in Database as Proxy
I have a Log system that compares two generic classes and writes the name of the property and its value in a column of my database. When the property is string, int, datetime, etc., it is saved to…
-
2
votes1
answer194
viewsModal pagination using Url.Action
I have a modal of products, in the controller page has a get function to complete it when opening, and a post for filters and pagination. My problem is that paging is done by Url.Action("Index", new…
-
2
votes1
answer310
viewsIs there a way to call a C function in C#?
Let’s say I have a library with a C function, which was compiled using gcc, there is how to call this function in C#, if yes what would be the performance of it compared to the same function created…
-
2
votes2
answers6086
viewsHow to verify that the framework is installed in the correct version?
Requirements to install the main software: .Net Framework 4.5.1 Service Pack 1 In other words, I am creating a download manager that downloads the correct version of the main software (32 or 64…
-
2
votes1
answer78
viewsHow to request authentication in an Asp.net menu item
I have the login form that is currently being used to enter the system, but I need to do this authentication also by clicking on a particular menu item. I need that when clicking on "Home", ask for…
-
2
votes2
answers286
viewsDifficulty transcribing a console application program for windows form(C#)
I was learning to use split and at the end I had this code: namespace String_Split { class Program { static void Main(string[] args) { string mensagem_completa; string palavra; string[]…
-
2
votes1
answer106
viewsUnderstanding #line directive
I’m trying to understand the directive #line. I read in that documentation and I was able to understand the applicability of #line hidden but not that of #line [any_numer]. Taking as example a file…
-
2
votes1
answer78
viewsOrganize EDMX Classes
I have a DB First project that uses an EDMX to map the database. The tables have standard columns that exist in all of them and that I could organize and make the code much more generic if it was…
-
2
votes2
answers108
viewsProject Empty Mvc. I can’t startar
I started doing a project from scratch using MVC 4 from VS 2012. As I opted for an Empty, I can’t get the view started. I took the route: routes.MapRoute( name: "Operador", url:…
-
2
votes1
answer265
viewsHow to pass a post with an array to a Webform URL
I’m trying to send an array with some elements in a post to a url. I called 'Webbroser' method, passed the parameters, but still I had no idea how to finish implementing. Follows my code: private…
-
2
votes1
answer88
viewsReturn from a Windowsservices via an ASP.NET application
I have a Windows Service which at a certain time scans the machine and performs a backup, to a folder on a server on the network. The Service is running on the machines perfectly and running the…
-
2
votes1
answer50
viewsAlert Resharper Access to modified closure
Implicitly captured closures or Access to modified closure It is a kind of warning that the Resharper shows in the code below, I would like to better understand this type of alert and what kind of…
-
2
votes3
answers533
viewsProblem when converting int to string
I’m trying to do a click counter in ASP.NET webforms and c#, and I need to convert the number int click-through to a string in label. Only this does not work, the page is displayed but the number of…
-
2
votes1
answer470
viewsUsing JSON in c# and adding points in GMAPS
Good morning, everyone, I’m developing a C# web application that uses GMAPS to add comments to addresses. I have a page on which the user inserts comments (and the page captures latitude and…
-
2
votes4
answers492
viewsOrable DB and MVC 4 - Connection error (ORA-06413)
I have a dll which is responsible for carrying out the consultations in the bank. Therein dll, in the connection class, I have a method that opens the connection to the bank and returns the…
-
2
votes2
answers690
viewsHow to get the data typed in the Textbox that was created dynamically?
I created some controls TextBox dynamically in my Code Behind and I need to redeem the values in a new method, but I cannot use the textbox changed in a new method. try { DataTable tbDadosAux =//…
-
2
votes0
answers93
viewsDecorator Pattern with Repository Pattern
Guys I have a need here and I’m having some difficulty to implement i have an application with Decorator Pattern and would like to update the data of my Components picking up the information…
-
2
votes0
answers151
viewsChange and Save Color from Datagridview Line
I want to change the color of the line DataGridView and even with you. Code: private void btnativo_Click(object sender, EventArgs e) { MudarCor(); } public void MudarCor() {…
-
2
votes0
answers4011
viewsThe underlying connection was closed: The connection was closed unexpectedly
I have a Webform project, and I’m passing an array to a method that will post to a specific URL. However, after I run the project and send the array to the method, it breaks with the error reported…
-
2
votes1
answer3982
viewsHow to send complex object to Web API?
I need to pass a parameter to my Controller in the Web API which is a complex object, this object has some normal properties (the most complex is a Datetime). I’m doing it this way, but I can’t…
-
2
votes1
answer266
viewsHow do I use an existing database in an ASP.NET MVC C# and Identity application?
I need to authenticate users. So I created my database with all my business rules, connected to the ASP.NET MVC application, and started programming. Now, when I went to do the login user realized…
-
2
votes1
answer189
viewsHow can I make a MVC lambda filter
I’m making a simple filter, and show the data on the page. The code I’m using is this: mt.ModelItens = db.Forecast .Where(f => (f.CanalForecast.area == idArea && f.CanalForecast.despesa…
-
2
votes2
answers5346
viewsAutomappermappingexception: Missing type map Configuration or Unsupported Mapping
I’m using the library Automapper to map my Viewmodels. I own my class Dbdominio: public class DBDominio { [Key] [Column("ID")] public long id { get; set; } [Required] [StringLength(128)]…
-
2
votes2
answers3604
viewsSpecified conversion is not valid
I’m making an appointment with LINQ in the DataTable in that code snippet. I have to check if a link already exists for a registered person in the database. My query using the LINQ is working…
-
2
votes1
answer75
viewsReduce code that refers to the same object?
Here the code, would you have any way to reduce it? (Just for learning reasons) worksheet.Row(1).Style.Font.FontColor = ClosedXML.Excel.XLColor.White; worksheet.Row(1).Style.Font.Bold = true;…
-
2
votes1
answer1007
viewsHow to implement PKCS#7 (components->class, library, dll, plugins and others) in a MVC5 web application
I’m trying to implement PKCS#7 in an application web mvc5 found some solutions for application desktop, never added desktop(class,dll,Ference etc) solutions to a web application, maybe it’s the…
-
2
votes1
answer88
viewsEvent Checked for Cross Platform Xamarin
You can create a button with the event Checked in Xamarin ? If yes, how to do ?
-
2
votes1
answer2263
viewsBank Account Validation Rules
Where do I get official bank account validation rules and check digit? After a lot of searching on Google, I can only find rules from ten years ago and on forums, with no source reference. I heard…
-
2
votes1
answer469
viewsHow to read an excel file in a console application in c#?
Guys, I’m trying to read a data from an excel table in c#,my code is like this: string resp; string rota= "D:/Users/e608871/documents/visual studio 2010/Projects/CEMIGID/CEMIGID/CEMIGID.xlsx"; var…
-
2
votes1
answer70
viewsRemove serial column creation Entityframework + Npgsql
Ola, I am creating an application using Fluent API + Entityframework. But in my domain classes when determining that a property is PK it automatically defines it as serial, I would not like to get…
-
2
votes1
answer1272
viewsHow to delete datagridview line?
Populo the datagridView thus: dgvProdutosErp.DataSource = produtos; // produtos é uma lista I try to remove as follows: foreach (DataGridViewRow row in dgvProdutosErp.Rows) {…
-
2
votes1
answer2250
viewsHow to access external network folders with c# Asp.net?
When I try to read files on another network (which requires authentication), the error below occurs. The same problem I also have when I try to access protected folders. Does anyone know how to fix…
-
2
votes2
answers743
viewsReceive by parameter a List of miscellaneous objects
I have the following problem described in the comment: public class Funcionario{ public long Id {get; set;} public string Nome {get; set;} public DateTime DataContrato {get; set;} } public class…