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
votes1
answer5075
viewsI need a movie API that returns Json
Gentlemen all good? Someone has a movie API that returns json if possible with the movie photo? I’m doing some examples of app with Xamarin but the api it uses in the example n works more..…
-
2
votes1
answer949
viewsProject C# Closing Visual Studio
I recently made a Console Application project that saves PDF files with Report Viewer and worked normally. I needed to change the SQL Server that generates these files and changed the directory to…
-
2
votes1
answer362
viewsHow Does Life Cycle Dependency Injection Work?
How the 3 life cycles of a dependency injection works such as Singleton, Transient and Scope ?
-
2
votes2
answers916
viewsHow to minimize an application in C#?
How do I minimize or close (to the tray) any application by C#? I’m trying to minimize Teamspeak to the system tray.
-
2
votes1
answer235
viewsTransaction control between two different applications
I am working on an application that is divided into two modules, each one in a language (.NET and Java). Application A (.NET) will manipulate the records of a table while application B (Java) will…
-
2
votes1
answer39
viewsTexblock - Make a text change event
I’ve seen the property of TextBlock does not have an event when changing text. Is there any way to do an event when the text is changed? * Remembering that it is for WPF and not Windows Forms. This…
-
2
votes1
answer858
viewsError using Tempdata in ASP.NET 5: Session has not been configured for this application or request
I need to use the TempData but gives the following error in Runtime: InvalidOperationException: Session has not been configured for this application or request. em…
-
2
votes0
answers48
viewsXamarin Forms. Collect camera frames
Greetings to all! There arose the need to develop an application where my greatest difficulty right now is to load the camera from the mobile phone on an object and somehow get some event…
-
2
votes1
answer169
viewsWhat are the "User" and "Cancellationtoken" parameters for?
I’m doing an implementation with the API from Google Drive, and in the code block: credenciais = GoogleWebAuthorizationBroker.AuthorizeAsync( GoogleClientSecrets.Load(stream).Secrets, new[] {…
-
2
votes3
answers641
viewsAdd zeros right Textbox C#
I have a TextBox which only accepts decimal numbers. But sometimes the user does the following: How to do for the event Leave of TextBox it add the two zeroes to the right, in the case of the image…
-
2
votes1
answer313
viewsInterop.word, find and replace, error:" The string parameter is too long."
I am using a template to create a document, I open a document that would be a template and use find and replace keywords that is in this document and soon after saved on my desktop as another…
-
2
votes1
answer31
viewsSocket.Beginsend Using a lot cpu
I have an online game server and have 600 online users, but the cpu is a little high (using 10~20% of 26GHz) and the profiler says that this line is using a lot of resources Socket.BeginSend(packet,…
-
2
votes1
answer324
viewsParameters between pages (ASP.NET Core / C#)
Hello, I have a question in which I already researched a lot and did not get any concrete answer. I am beginner in C# and ASP.NET, forgive me for ignorance. I have a project in ASP.NET Core MVC. On…
-
2
votes0
answers835
viewsError loading XML in Xdocument
I’m consuming a Webservice with the following code WebRequest request = WebRequest.Create(link); byte[] bytesToWrite = Encoding.ASCII.GetBytes(xml); request.Method = "POST"; request.ContentLength =…
-
2
votes1
answer707
viewsVisual Studio Error - Cannot find name 'Record'
I am working on an ASP.NET project with c# in Visual Studio 2015 and I came across an error in the file index.d.ts. The error messages are Cannot find name 'Record' and Cannot find name…
-
2
votes1
answer229
viewsRedirect with MVC Timer
I have a little problem I’m cracking my head to solve. I am building an MVC website and would like to make a opening page with Timer rolling like this image: So far, great. The problem is that I…
-
2
votes1
answer111
viewsHow to print the name of the method, file and line that was called?
Example: file name: teste.cs A part of the code: ... public void MeuMetodo() { // suponha que essa linha seja a 100 Console.WriteLine("Arquivo: " + arquivo + "Metodo: " + metodo +" linha: " +…
-
2
votes1
answer472
viewsUninstall packages and all their dependencies at once
Is there any way for me to uninstall Packages and all their dependencies in a single command? Without having to uninstall one by one. Type: Unable to uninstall 'System.Net.Http. 4.3.3' because…
-
2
votes1
answer314
viewsView call @model of the controller
I use the EF Design and import all my models from the bank to a .EDMX. I ask you: How do I call the objects of controllers that I create, within a View? I’ve tried to put @model up to the controller…
-
2
votes1
answer60
viewsSumasync return zero
I have an appointment in LINQ where do I use the SumAsync, however when my entity is empty I have the exception: The cast to value type 'System.Decimal' failed because the materialized value is…
-
2
votes2
answers2514
viewsHow to delete a specific line from a file?
My goal is that when the user removes an item from a Listbox, the program delete a certain line from a file. I have this text in a file .txt: linha1 linha2 linha3 In the Listbox contains the…
-
2
votes1
answer802
viewsRead file . txt, send Line and Delete it after confirmation of receipt
This code is the fragment of a method that reads a text file and sends its content line by line, where each sent line receives a confirmation of receipt. I would like to delete from the file the…
-
2
votes1
answer393
viewsMOIP consumes Json Web Api MVC
I need to use the Moip Payments API as a payment method for my system, how do I request via json? Documentation Consultar cliente GET Por meio desta API é possível consultar as informações e…
-
2
votes1
answer2011
viewsSelect with LIKE argument %
I’m trying to perform a select, using LIKE and defining the argument %: WHERE title LIKE '%computer%' locates all book titles with the word 'computer' anywhere in the book title. source:…
-
2
votes1
answer58
viewsAdditional information: This Row already belongs to this table.
I am developing a system that searches for information in an excel and does some treatments to save the data in a dbf database. All the treatments I do are on top of Datatables, so I use dataRows…
-
2
votes0
answers341
viewsHow to return the value of an ID when selecting an auto complete record
Good afternoon. Reformulating my doubt. As said I am making a sales site in Asp.net. I tried to create a search engine, like Google and Facebook, that will filter the results. I found that Asp.net…
-
2
votes2
answers1023
viewsXml Tag base64Binary C#
I have the following xml tag (I’ll summarize for size): <docZip schema="procNFe_v3.10.xsd" NSU="000000000001868">H4sIAAAAAAAEAN1aWY+jyLJ+Pv..bla bla bla</docZip> The field type is…
-
2
votes1
answer815
viewsDynamic Image Gallery ASP.Net C#
I have the following Code, It loads the photos into that placeholder. ID="phFotos"> public partial class ImovelDetalhe : System.Web.UI.Page { private ImovelBo _imovelBo; protected void…
-
2
votes0
answers234
viewsConvert RTF to HTML
I need to convert the RTF content from a string to HTML, in Javascript or C#, but all the Apis I found on Github either didn’t have enough information for the implementation or had some error. So, I…
-
2
votes1
answer489
viewsConditional expression type cannot be determined because there is no implicit conversion between "<null>" and "Datetime"
Follows code: string data_string = "17/01/2018"; DateTime? data = data_string == string.Empty ? null : Convert.ToDateTime(data_string); I get error: CS0173 error Conditional expression type cannot…
c#asked 6 years, 8 months ago Matheus Miranda 5,375 -
2
votes1
answer174
viewsNull value is going to the ajax error function - ASP.NET MVC
I am developing a ZIP consultation page where sending and feedback information is done in ajax: $.ajax({ url: "@Url.Action("PesquisarCEP", "CEP")" + "?cep" + retirarMascara($("#dsCEP").val()), type:…
-
2
votes0
answers603
viewsLoad progress bar as import C#
How to make progress bar load as excel file import is in progress ? My code so far: ASPX: <asp:FileUpload ID="FileUpload" runat="server" Style="margin-top: 4px" /><br /> <div…
-
2
votes1
answer223
viewsProblem with Mysql connection in C#
I created a connection class for my application in Xamarin, but every time I try to connect throws this exception: "The type initializer for 'Mysql.Data.Mysqlclient.Replication.Replicationmanager'…
-
2
votes1
answer4221
viewsAsp.net web api From Ri and From Body when to use?
Asp.net web api that serves [Frombody] and [Fromuri] and when there is real need to use ? example: public IHttpActionResult Get([FromUri] email) { } public IHttpActionResult Get([FromBody] email) {…
-
2
votes1
answer124
viewsDictionary<string, string> or Namevaluecollection?
What’s the difference in using Dictionary<string, string> and NameValueCollection? I researched, but only found in English in the same Sopt, I used the translator, but the translation became…
-
2
votes1
answer867
viewsUpdate multiple databases using code first without using console
Good afternoon, you guys. I have an application that each client has their database and I am using the code first. To update I am always running in hand the command update-database -force in the…
-
2
votes1
answer899
viewsError opening Sqlconnection
The following I have a gridviewer that is connected to a Query with a Table called Server Table. I want to add some things to the columns gives the following error Instance failure. In this part of…
-
2
votes1
answer157
viewsWhy is it not possible to capture exceptions triggered by async void?
Why it is not possible to capture exceptions triggered by non-recurring asynchronous methods Task? public async void calcularPrecos() { var tabelaPreco = await getTabelaPreco(); /* Blá, blá, blá...…
-
2
votes2
answers488
viewsWeb Paging with C#
I’m building an administrative application, and in this application I have a message page. I am currently bringing the last 20 messages. I already have the screen ready to receive this messages, but…
-
2
votes1
answer2668
viewsSql runs on Oracle SQL Developer, but does not run on C#
vsql = @"INSERT INTO ALUNOS_ (UF, IDADE, TELEFONE, NOME_PAI, ENDERECO, EMAIL, NOME, CIDADE, NOME_MAE) values ('sp', 0,'','','','','','','');"; This SQL when running on oracle does the insertion but…
-
2
votes1
answer142
viewsDisplay the ID of another table in Datagridview
How do I display the ID of another table in my DataGridView? I can display all fields except ID. var novaListaPessoaFisica = listaPessoaFisica.Select( pessoaFisica => new { PessoaFisicaID =…
-
2
votes1
answer78
views -
2
votes1
answer90
viewsHow to call Linq method in View?
Good morning, everyone. my question is this, I have the following method in my model: public IQueryable GetConsulta() { var q = (from c in Datacontext.Tabela1 join b in Datacontext.Tabela2 on…
-
2
votes1
answer518
viewsWhere should I put Connectionstring in Windows Forms Applications with EF?
I have the following error using Entity Framework: Additional information: No Entity Framework Provider found for the ADO.NET Provider with invariant name 'System.Data.Sqlclient'. Make sure the…
-
2
votes1
answer194
viewsStore all types of variables in an array/array?
How can I store values and variables of all types within a vector? Ex: vetor1.Add("valor em string"); vetor1.Add(100); vetor1.Add(100.10); vetor1.Add(-100); I have no idea how I can do this.…
-
2
votes2
answers46
viewsHow to have access to Label again in Visual Studio
I put a Label in the form, I edited its name to be empty, renamed and so far so good, and I can no longer select it in the form for manipulation. It works within the application bringing the…
-
2
votes2
answers290
views -
2
votes2
answers520
viewsChanging Rows in Datagridview / Opening a form with different design
I have a problem in a school project, as stated in the title, I need to change Rows and open a form that already has your design, but with different things, come on: The program is very simple, a…
-
2
votes1
answer196
viewsCortana app creation in English is not working
First I created the following xml: <?xml version="1.0" encoding="utf-8" ?> <VoiceCommands xmlns="http://schemas.microsoft.com/voicecommands/1.2"> <CommandSet xml:lang="pt-BR"…
c# visual-studio windows-phone windows-10 cortanaasked 8 years, 1 month ago Severino J. Da C. Neto 77 -
2
votes1
answer108
viewsUpload videos Datatype Asp.Net MVC
I want to put a Video Upload field on my Asp.Net MVC system and I did not find anything related to videos on Datatype. I found various datatype such as [DataType(DataType.ImageUrl)]…