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
votes1
answer210
viewsSend email to register form
Personal I need a help from you, I have a form on my system, I need when I register it send an email to a user. When I click save I enter this post to save the data. [HttpPost] public void…
-
1
votes1
answer2400
viewsWebapi 2 Route Configuration web form application
About 6 months ago I am entering the MVC world, before I used a lot of Webforms and I confess that I have difficulties understanding how to configure the routes for a ApiController, from what I…
-
1
votes1
answer393
viewsHow to import log file into Asp.net mvc with Entity framework
I would like to ask a question and I do not know how to structure my need.. I need to import/export a file with records, and depending on each record will be a different table, with its references…
-
1
votes1
answer158
views.Orderby dynamically in Lambda
I have a field int called OrdemDosProdutosDestaque where I store products order preference (My customer choosing and storing in the database). ex: 1=Aleatório 2=Preço 3=Referência 4=Categoria etc..…
-
1
votes0
answers181
viewsProblems with Xamarin in Visual Studio 2015
I’m starting to "play" with mobile development and as I already develop in C#, I wanted to use Xamarin. But, as soon as I installed and update/installed everything I had in the android SDK manager.…
-
1
votes1
answer76
viewsError using Sqlcommand and foreach
I’m trying to go through a list of objects and persist your data in Sqlserver: foreach (var item in pedidos) { cmd.CommandText = "INSERT INTO MinhaTabela (Coluna_A, Coluna_B, Coluna_C) " + "VALUES…
-
1
votes1
answer296
viewsClear the console every 30s
How do I clean the console every 30s every time? I tried to create with timer but it didn’t work, or I must have done wrong. Follows the code: var time = new Timer(LimparConsole,null,0,30000);…
c#asked 7 years ago user92401 -
1
votes1
answer655
viewsMap relationships with Fluent API
I have three simple classes of city, state and country. I realized that simply declaring a property of the type Estado in class Cidade the foreign key is generated correctly. I would like to know…
-
1
votes2
answers795
viewsDisplay date formatted in datagridview
In the datagridview has a date field in the format yyyyMMdd and need to display formatted in the correct form. tried this: dgvRequisicao.Columns["data"].DefaultCellStyle.Format = "dd/MM/yyyy"; But…
-
1
votes2
answers449
viewsHow to create summation with "sum" with multiple queryover columns
People need to create a query with queryOver(Nhibernate) C#, to add more than one column. Example in pure sql: SELECT SUM(coluna1 + coluna2 + coluna3 + coluna4) FROM tabela First I did so: Tabela…
-
1
votes1
answer152
viewsDoubt with Dependencyservice Xamarin c#
I created a project just android using Xamarin Problem : problem at this point does not recognize Dependencyservice An interface : namespace Projeto.Xamarin.Android { public interface IConfig {…
-
1
votes2
answers403
viewsDoes anyone know how to get data from the grid cell?
Good evening guys, I have a history grid where appears the service rendered and I have two more grid below with the paid debits and pending debits that I wanted to take from the top grid clinha in…
-
1
votes1
answer102
viewstabpage - read-only textbox
Guys good night how are you? I have a form, with a tabpage, and with some textbox, I’m trying to deploy in the page load, that the property isreadonly is true. but I’m not getting it, I’m using the…
-
1
votes1
answer445
viewsHow to check if the user typed something when prompted for a C#entry
The following validation checks whether an entry is a positive number. if (Q[i] < 0) { Console.WriteLine("Digite um número positivo!"); goto Start; } Just like this check, if nothing was typed,…
c#asked 7 years ago Rodolfo Fonseca dos Santos 21 -
1
votes2
answers570
viewscmd.Commandtype = Commandtype.Text - Pq use?
Good morning guys. I’m populating a grid, and after searching the internet, I saw that some use the command: cmd.CommandType = CommandType.Text; My doubt, is, why use? what’s the difference? I did…
-
1
votes0
answers35
viewsDownload audio with Unity on android
I’m trying to download an audio, in the editor the download works, but after installed apk on mobile phone, it downloads the file, soque not complete, it saves a 40b file, while the file saved in…
-
1
votes0
answers740
viewsAccess to the path was denied by doing "File.Writealltext"
Follows code: public static string pathname = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory.ToString()) + @"\Arquivo_Principal"; if…
c#asked 7 years ago Matheus Miranda 5,375 -
1
votes0
answers58
viewsDependency Injection and Specification Pattern
Good night. Can anyone give me a help to understand this issue of Specification Pattern and Dependency Injection? For example: In my service layer I need to check if the user has filled in some…
-
1
votes0
answers1615
viewsProblem: Unable to load file or Assembly. Unsupported operation. (HRESULT exception: 0x80131515)
Good night, I have developed a program and need to implement PDF printing functionality. Doing research on the Internet I found what I need, but there’s a problem. When I run the code in a separate…
c#asked 8 years, 4 months ago Diego Farias 909 -
1
votes2
answers1487
viewsSave Image in Database with C#
Hello! I saw the example Upload image to picturebox and write to database but I didn’t get that part: FileStream Stream = new FileStream(imgLocation, FileMode.Open, FileAccess.Read); What would this…
-
1
votes2
answers1164
viewsHow to make the selected line font bold in Datagridview?
In Datagridview of Windows Forms it is possible to change the font color and background color of the selected line easily using the properties DataGridView.DefaultCellStyle.SelectionBackColor…
-
1
votes0
answers44
viewsError and Warning when changing the Anycpu platform to x64
I had a problem, which, when trying to capture 64 Bites processes on x86 platform, an exception error occurred. I managed to solve it by creating an application 64 and a 32 Bites. I packed all the…
-
1
votes1
answer304
viewsUse Text User Interfaces in C#?
I would like to give a basic interface to an application developed in Console Application. I want to make use of features like TUI (Text-Based User Interfaces), common on other platforms like…
-
1
votes1
answer701
viewsRadio button in gridview
Good morning, everyone. I need to create an online form that will have questions that will be inserted daily in each user’s profile. All questions are stored in a database along with their…
-
1
votes1
answer345
viewsConverting E MMM dd HH:mm:ss Z yyyy to dd/MM/yyyy HH:mm:ss c#
I’m getting the following date Thu Sep 01 00:00:00 BRT 2016 and need to convert to dd/MM/yyyy HH:mm:ss Only that the Convert generates error, I’m receiving this date via string of a System. Can…
-
1
votes1
answer57
viewsView window without frameworks
How can I display a window without using frameworks? For example, display the console window or another without the . NET and others frameworks.
-
1
votes1
answer648
viewsImport MS Access data to Sql Server via code
I need to import data that is in an Access database via Sql Server code. My software that is made in C# for many years has been integrated into an Access database. From now on we are migrating to…
-
1
votes1
answer764
viewsASP.NET MVC error when displaying date and time fields in View
Hello I’m having some problems presenting at View. In the database I have this data recorded: Starting date: (datetime) 1998-11-16 00:00:00.000 Date: (datetime): 1998-11-16 00:00:00.000 Time entered…
-
1
votes1
answer255
views -
1
votes1
answer172
viewsProject class library does not open. Gives error in . csproj it
That is the mistake: There is how to generate a new . csproj or fix this or I have to create a new project and import everything into it?…
-
1
votes1
answer2079
viewsGenerate C# class from XSD
I need to generate the class from a file. XSD. Though I’ve tried everything I know (used . net tool: xsd.exe, httputility.net and other . Cs generators) did not succeed. I think the mistake is in…
-
1
votes1
answer34
views@Html.Action in _Shared error when sending a Viewmodel by Controller
In my _Shared have a Partialview calling for _rodape.cshtml but now she will need to receive a Viewmodel which will have various data. Like I don’t want to create a Action in each Controller, I…
-
1
votes2
answers2237
viewsDownload all files from a folder on FTP?
Good morning, I am developing a system that does file exchange . txt via FTP. I need to download all the files that are in a certain folder. Today I can download one file at a time, in case I pass…
-
1
votes1
answer139
viewsGrab all images from a subdirectory except for a folder
I’m picking up all the photos from a directory and its subsequent ones, but I wouldn’t want it to be the "Backup" folder, as I could do that? string[] Arquivos = Directory.GetFiles(PathEx, "*.*",…
-
1
votes1
answer308
viewsCharset problem between Asp.Net MVC with Entity Framework and SQL Server
I’m having a problem that all the values that come from the bank SQL Server, are having accentuation problem. When written words are directly on HTML, does not give this problem. What is strange is…
-
1
votes4
answers1566
viewsASP.NET MVC input number
I’m trying to use a input with type=number, but in Chrome is giving that the value informed should be a number. The problem is the state model that is returning invalid, because when giving the…
-
1
votes1
answer182
viewsOverwrite static method
I don’t even know how to ask the question, but I’ll try. I have a static method in a parent class, and I planned to overwrite in the child classes, but from what I’m seeing here, this is not…
-
1
votes0
answers31
viewsHandling Entity Framework Data Using C#
I have a database connection using the Entity Framework. The code is as follows: public IQueryable Empresas() { int idUser = Int32.Parse(self.IdUser()); var res = from s in db.EmpresaUsuario join c…
-
1
votes1
answer714
viewsExample of Sendgrid V3 with attachment
I am in need of an example code for sending email with attachment using sendgrid Web API v3. using (var client = new HttpClient()) { client.BaseAddress = new Uri("https://api.sendgrid.com/");…
-
1
votes1
answer535
viewsCapture results using Htmlagilitypack
I’m using this code to get results using the Html Agility Pack. This is how it is: WebRequest request = WebRequest.Create(texto); WebResponse response = request.GetResponse(); StreamReader reader =…
-
1
votes1
answer1680
viewsReplace com does not work
I’m trying to make a Replace() but it doesn’t work. I need to change \ for \\. "\r\n".Replace(@"\", "\\"); he just returns me : "\r\n" and not "\\r\\n".…
-
1
votes1
answer1616
viewsCreate a Web Api that calls another Web Api
I created a Web Api here in my work to be consumed by my project Xamarin Forms. It’s working 100% and no problems... Then I was informed that actually here we use 2 web api s for security. That is,…
-
1
votes1
answer808
viewsFormat dates in sql
I have a program in c# (Visual Studio) of registration that contains a textbox to receive a date. Knowing that SQL records the date in American format, how can I make the user to enter the date in…
-
1
votes1
answer27
viewsHow to escape Sqldatasource.Filterexpression?
I have a function that adds a filter to the SqlDataSource. That expression contains a LIKE at the consultation. However, if the person places a character such as ', an error (which evidences SQL…
-
1
votes1
answer97
viewsHighlighting does not work in Razor MVC 5 views
I’m with a Razor ASP.NET MVC 5 project that was created on VS2013 on another computer. Loading it on my computer with VS2012 Highlighting and Views Intellisense (cshtml) does not work. I realized…
-
1
votes1
answer305
viewsDevelop an MVC project with Web API
Someone asks me to develop an MVC application with various technological elements such as Angular, Bootstrap, Entity and so on. I then create a Web API project, can I guarantee to this person that…
-
1
votes1
answer60
viewsReturn number of cells according to parameter of a datatable
Do I need to take duplicate cells from a particular column, is there any language function that returns these duplicate cells to me? Example: coluna-1 coluna-2 1 87 2 9 3 12 1 17 2 28 would have to…
c#asked 6 years, 11 months ago Gabriel Souza 728 -
1
votes1
answer98
viewsNhibernate is modifying property when returning by Web Api
I have a web service api where a query to the bank is relaunched through nhibernate, but when returning the object, its referenced properties are overwritten, I believe it is because of the…
-
1
votes0
answers343
viewsBootstrap is not being rendered by _Layout
I have this layout page. This layout already came, I didn’t make it. I just don’t understand why it was created if I opted for a MVC Empty(Empty) project, but it’s not bothering me. <!DOCTYPE…
-
1
votes0
answers113
viewsVisual Studio 2017 only recognizes new code if restarted
Good guys, I’m having a problem with VS 2017 when compiling or even when pulling a code via Git... VS 2017 only recognizes the new code if I do some of the following: close and open it again, insert…