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
-
7
votes1
answer1161
viewsC# Winforms - Autocomplete (filter) combobox when typing
I have a Combobox (cmbBairro) with the names of the neighborhoods of my city, which carries the values of a List (_Listneighborhoods). When the user tries to search a neighborhood by typing, he…
-
7
votes3
answers2007
viewsHow to obtain information from an SSL Certificate via C#?
How to obtain information (expiry date for example) from an SSL certificate via C#?
-
7
votes1
answer976
viewsHow to move files read by Streamreader in C#?
I am trying to move some files. For each file containing the word "TEST" in its body, my application indicates being a found item. The goal is to move them to another directory. Follow the code…
-
7
votes2
answers1066
viewsListview or Gridview in Windows Forms
I’m studying about Windows Forms Aplication. I made a tutorial where Listview is used to display the data of a query according to the parameters passed. But I noticed that you also have Gridview for…
-
7
votes3
answers15498
viewsC# dynamic COMBOBOX (SQL BD table data)
I need to load a combobox with the data from an SQL DEPARTMENT table (with code and description/ the description is displayed in the combobox but what is caught is the code) I used a datasource (the…
-
7
votes2
answers313
viewsAccess variable based elements
I need to assign the value to a label, example: xrLabel1.text = "teste", but as I have several Labels where changes only the number at the end example: xrLabel1.text = "teste"; xrLabel2.text =…
-
7
votes1
answer481
viewsPopulate aggregate class from datatable using a Dataset with LINQ C#
I’m having trouble filling an aggregate class in C#. Is it possible using LINQ? Does anyone have any example of how to solve this problem using the return of a DataTable or DataSet? public class…
-
7
votes1
answer11539
viewsHow to Create Dropdownlist in ASP.NET MVC 4
You could help me create a DropDownList on MVC4? I have the class ProjetoFuncionario which is an associative class of Projeto and Funcionario. I must create a class for Dropdown? I’m having a hard…
-
7
votes4
answers4198
viewsHow to save and upload data from a . txt to a gridview?
It’s been two days since I’ve been looking for help for my problem, but everything I think doesn’t fit. I’m doing a simple program, as if it were an agenda, where I put all the records of my store.…
-
7
votes2
answers8059
viewsRun Windows Prompt commands and save the output in a text file
I have a program that launches a command of Prompt windows. I want to copy the output of this command and save to a text file. Example: The command is ipconfig and I want the output to be copied to…
-
7
votes2
answers718
viewsHow do I add two strings in C#?
I have a method that will take two strings and return the sum of them in string format. I use string because there will be +-30 digit numbers. I’m having trouble converting to add. :/
-
7
votes2
answers1287
viewsConvert Base16 string (Hexadecimal) to Base10 (Decimal)
I have the following string "615769EF", hexadecimal. How to convert it to base10 and let the result be the string "01633118703" ?
-
7
votes1
answer657
viewsSave files from a Datagridview
I would like to know how to get all the content that was passed to a Datagridview and save it in an Excel file. So far I have it: private void btnDiretorio_Click(object sender, EventArgs e) {…
-
7
votes2
answers1398
viewsReturning a list using select new with LINQ
I can do it: var filial = (from f in base.EntityContext.vw_filial select f).ToList<vw_filial>(); But I want to do something like this: var filial = (from f in base.EntityContext.vw_filial…
-
7
votes2
answers1209
viewsCan Enum values only be integer?
Studying C#, I came across a situation, I want to receive a value (string) by the console. And then compare it to the value of a Enum. For example: [Serializable] public enum Command { Exit =…
-
7
votes2
answers212
viewsWhy Arraylist instead of Stack in the implementation of the Memento standard?
As you all know, the Memento pattern is the pattern that saves different states of objects and then retrieves them. The intention is not to retrieve the "last" to enter and then remove it? This is a…
-
7
votes5
answers2024
views -
7
votes1
answer898
viewsIs it correct to save multiple entities at the same time in the ASP.NET MVC Controller?
I need to save 12 entities in the same method, in the Controller, I don’t know if I’m doing it right. In my method Create of Controller, call all entities and add all attributes in the same View. By…
-
7
votes1
answer1637
viewsHow can I test authenticated webservice?
Hello, I have an authentication service already mounted in c# and wanted to do any test with it. It can be a webform page, which returns a positive or negative, or a class c# even if it runs per…
-
7
votes4
answers5703
viewsSchedule process execution in C#
I have an application that will run 24h/day the 7 days/week, IE, It will always be running. I need that at a specific time, every day a method of this application is called.
-
7
votes1
answer3240
viewsHow to rotate the character as the mouse moves?
I’m learning how to play a game, but even if I follow it step by step, I think I did something wrong. It moves correctly but just keeps looking forward and does not turn, I do not know if it is…
-
7
votes2
answers607
viewsResource on an Enum
I have a enum and would like to change the Description with Resource: public enum SystemArea { [Description("Gestor")] Gestor = 3, [Description("Administrador")] Administrador = 2,…
-
7
votes3
answers190
viewsSeveral tables that should represent a single entity
I am updating a system that has eleven tables that represent a single entity, I believe by implementation error, as an example below: Entidade: Foo Tabela Foo1 - Campo1, Campo2, Campo3 Tabela Foo2 -…
-
7
votes1
answer182
viewsIs it possible to use MD6 in C#?
Speaking of hash, it is possible to use MD6 in C#? Someone would have an example of the use in a simple string? In my research I found nothing very objective.
-
7
votes2
answers129
viewsBoxing is copying the data
Boxing is to transform value type in Reference type, right? But when we copy a Ference type into another Reference type, it just copies the address and not the value. But when I convert int for…
-
7
votes3
answers2024
viewsKeep application (Windows Form) open in icon tray with C#
How to do that when closing the application (either by close button, ALT F4, or any method other than the process manager), the application continues running in the Windows icon tray: And it is very…
-
7
votes3
answers660
viewsLINQ corresponding to SQL with clause LIKE 'XXX%'
I am using the following LINQ to return a query: .Where(c => c.Nome.Contains(nome)).OrderBy(c => c.Nome) But if the name is Maria, he brings: José Maria Maria José How to bring organized as if…
-
7
votes1
answer664
viewsSOAP communication error. Lack of XML tag ending character
It took me a while to implement communication with Webservices SOAP in legacy applications written in Delphi 6. The Webservices I needed to communicate with these systems were written in Delphi…
-
7
votes2
answers4326
viewsProxy connection: HTTP 407 Proxy authentication Required
I created a project for ASP NET where I want to get the data of an address from the zip code by calling the url on a webservice. On my machine works normally, but on the machine I work, there is a…
-
7
votes1
answer1432
viewsHow to get a List<string> C# and send to a JS variable?
I am developing in an Asp.net C# project and I don’t know how to get on the page a list of strings of my class. How do I get these values? Code I’ve been using. var pontos=…
-
7
votes1
answer115
viewsInternal X public access modifier
When using public or international? Is there any advantage/disadvantage between them?
-
7
votes1
answer1457
viewsHow to use multiple models in a view
I’m doing a criminal record and I have the following models: Pessoa Fisica Juridica And in the code of mine view I have only the declaration of a model: @model CodeFirst.Models.Fisica The problem is…
-
7
votes1
answer1504
viewsHow to publish a . EXE secure, other than through Click Once . Net
My scenario is composed as follows: I have applications, which are configured according to each customer, are apps sold in bulk, I have a support system, which automates this configuration and…
-
7
votes2
answers6238
viewsHow to know if the file is being used by another process before trying to read
My system does N jobs on top of a list of files, eventually I get this exception: System.IO.Ioexception: Process cannot access file 'C: XXXXXX xxxx.xxx' because it is being used by another process.…
-
7
votes1
answer451
viewsWhat is the advisable way to mount a query?
What is the advisable way to mount a query in C#? It is advisable to use concatenation with the operator +? For example: query += " WHERE nome LIKE '%" + nome + "%'"; Here follows a query I set as…
-
7
votes1
answer310
viewsMany Update to Many Entity Framework c#
Good morning, I am having difficulty updating a record with entityframework, I will inform the whole structure below. In short, I have a register of artists, where these artists are related to…
-
7
votes3
answers1566
viewsConvert World/Excel to PDF
Does anyone know of an open source api for converting world and excel documents to pdf? I am currently using windows Interop however it only works if I install the office on the server. I need to…
-
7
votes1
answer272
viewsFill in a collection type property
Good personal evening how to fill a collection property using this type of structure in a class: public class Order { public string orderNumber {get; set; } public DateTime orderDate {get; set; }…
-
7
votes2
answers1148
viewsHow to get all selected values in a Datagridview?
I’m trying to get all the selected values in one DataGridView and add to a IList<Object> but shows an exception. How to do this ? I’m trying like this. IList<Modulo> lista =…
c#asked 8 years, 6 months ago FernandoPaiva 1,562 -
7
votes2
answers249
viewsComparison with Postgresql database using C#
I created a Login application, made the connection to the database, I can get the user and password registered in my database. But what I want, is, if the user tries more than three times to enter…
-
7
votes2
answers664
viewsWhat are the advantages of Parallel.Foreach in C#?
Working with C# I saw that we have the option to work with parallel.ForEach(). What is the advantage of working with her and not the foreach?
-
7
votes1
answer87
viewsUse of predicate and lambda expression
I am studying WPF and the MVVM model by the following article : https://msdn.microsoft.com/en-us/magazine/dd419663.aspx In the implementation of the Icommand interface, the author defines the…
-
7
votes2
answers1573
viewsHow to access next and previous record with C# using Entity Framework
I am developing a Windows Form application, with Entity Framework 6 + Mysql. As is common in systems, I have in each form navigation buttons (First Record, Previous Record, Next Record, Last Record)…
-
7
votes1
answer161
viewsEdgejs and Entity Framework
Next, I am learning Nodejs and I am delighted with the same, however I found my first stone on the way, access to relational database using some ORM (precisely to access Postgresql). Initially I…
-
7
votes2
answers1801
viewslist.foreach vs foreach
I have a list of several string, there’s a difference between going through the list values: In this way: ListaString.ForEach(delegate(string str) { Console.WriteLine(str); }); Or this:…
-
7
votes3
answers629
viewsEF6 + Postgresql - 22021: invalid byte Sequence for encoding "UTF8": 0xc9 0x52
I am trying to get data from a Postgresql database with Enconding SQL_ASCII, but in some records I get error message "22021: invalid byte Sequence for encoding "UTF8": 0xc9 0x52" I have tried to set…
-
7
votes1
answer330
viewsIs it recommended to use C# 6 in Visual Studio 2013?
In the Visual Studio 2015 I see that it is possible to define the version of C#: Source: http://www.codeproject.com/Tips/865579/How-to-change-targeted-Csharp-version-in-Visual-St But in the Visual…
c# visual-studio visual-studio-2013 ide .net-compiler-platformasked 9 years, 1 month ago rubStackOverflow 7,372 -
7
votes4
answers492
viewsIn C# is it possible to use a local alias for class or namespace?
In languages like Python or PHP it is possible to use a local alias for classes or namespaces. PHP example: use Vendor\Package\ClassName as C; use Vendor\Package as P; $class = new C; $class = new…
-
7
votes1
answer1825
viewsHow to Identify and Count Prefabs Collision in Unity
I am developing a game for android on the platform Unity that is similar to the game Tetris, the difference that is geared to chemistry, and instead of descending the tetrominos will descend the…
-
7
votes1
answer1294
viewsPhonetic search on SQL server
I need to implement phonetic search for Portuguese (br). Does anyone have any phonetic search solution in SQL Server with c#? The search should search inside a string using the SOUNDEX function or a…