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
answer228
viewsSignal the receipt of messages
The customer has 7 stores and a headquarters. Someone in the matrix with decision power, will keep your mobile in hand with an app. When an employee of one of the stores needs to approve a higher…
-
1
votes2
answers250
viewsObject error not instantiated
I have a model calling for ClientesModel. Inside it I have the fields: public int id { get; set; } public int codcli { get; set; } public string nome { get; set; } public string endereco { get; set;…
-
1
votes0
answers76
viewsHow to write XML string in a tag using Xmlserialize
When I pass the string and Gero through Xmlwritersettings.xmlSerialize passing the data without any specific characters, it still generates in the following way. Briefly, I have an xml document…
-
1
votes1
answer1233
viewsAdd days on increasing date via For
In the code below I add 1 to each step in the variable i, to add 30 days in the field dt, I need another for or you can do it yourself? DbConnection cnx = ADO_Utils.GetConnection(); DbCommand cmd =…
-
1
votes1
answer48
viewsError with lambda and fields float
Every time I carry my lambda, I make that mistake: System.Invalidoperationexception: 'The specified cast from a materialized 'System.Double' type to the 'System.Single' type is not Valid.' This only…
-
1
votes1
answer1346
viewsHow to use POST on a json for an Http server
I was thinking how can I post a json to an http server. The code I am using to do json is as follows: Person person= new Person(); product.FirtsName = "Ola"; product.ID = 1; product.age= 10; string…
-
1
votes0
answers85
viewshow to put the reminder class on a list;
I’m making an app that will be like a calendar and in it will have a part to save reminders, what I wanted to know is how to put the reminder class in a queue( appear in the queue several different…
-
1
votes0
answers129
viewsView Image List View
I have a screen, which through a List View, display a photo per register listed. <td class="col-md-1 text-center" style="vertical-align: middle"> <asp:Image runat="server" ImageUrl='<%#…
-
1
votes2
answers433
viewsDeserialize array in Json
I am accessing an API and the return is an array with latitude and longitude respectively. Unfortunately, I am not able to deserialize because it has no properties in Json. How can I get this in C#?…
-
1
votes0
answers48
viewsConvert Anonymous Object
How can I convert an anonymous type object to a known class using Linq version 4 with Entity Framework in C#?
-
1
votes0
answers26
viewsWhat is the difference between var and private var?
What’s the difference between private string s; and string s; ? Is there any difference between the two examples or is it just the way to write?…
-
1
votes1
answer797
viewsHow to include a line at the beginning of a text file?
My system generates a text file, and based on the sum of an information that appears on each line, it makes the calculation of a checker digit. However, this result should be in the first line of…
-
1
votes0
answers149
viewsError generating Migration after changing a relationship
I’m having an error when changing a relationship Many to Many in the Entity framework I had 3 classes: Politics 1-n Politicabnormal n-1 Normative It turns out that I didn’t want to map this…
-
1
votes3
answers73
viewsHow to debug code with Object Initializer format
Following some good practices that Visual Studio itself recommends, we cannot debug values of an object one by one using the "Object Initializer" or "Object Initializer". How best to get around this…
-
1
votes1
answer167
viewsError Running a query with npgsql + Dapper in postgresql
I can capture my "user" object that has inside of itself a "Login and a Password" and, when executing the function by my ORM, I catch the following error message: {"42883: operator does not exist:…
-
1
votes1
answer53
viewsPersist the same record by different user
I’ve seen that there’s a way, but I can’t remember how you do it and not a keyword for me to search. Suppose that distinct users edit the same record, when the last user will persist the information…
-
1
votes2
answers1520
viewsParameter in bold C#
I have the following string: string frase = string.Format("A data de hoje é: {0}", DateTime.Now.Date); Is there any way to make the parameter bold?
-
1
votes2
answers317
viewsRandom list in Query Linq to Entity C#
I would like to get a list of 3 objects within a query Link. var listaPessoas = from i in this.Context.CreateObjectSet<listaPessoas>() select i; ... listaPessoas = listaPessoas .Where(x =>…
-
1
votes2
answers1587
viewsCreate line chart windows form
Hello, I need to create graphics in windows form of dynamic forms, this working correctly, however I would like the graph to be of line, and this generating of bars, anyone could help me? Code:…
-
1
votes1
answer499
viewsForm validation with MVC Dataannotations
I’m trying to validate forms with use of Dataannotation, I tried direct on model or in my viewmodel and none of them works. View Model: public class CieloViewModelTransacaoPartial {…
-
1
votes2
answers275
viewsRecursion in the Entity-framework
I’m starting in c# and I’m having some difficulties with Entity-Framework. I have the following scenario: public InstituicaoMap() { // Primary Key HasKey(t => t.IdInstituicao); // Properties…
-
1
votes3
answers2378
viewsSend a List<T> with multiple items to the controller
Well, I’m facing the following problem in a project I’m working on: how to pass a list (List) with approx. 500~1000 View lines for the Controller? Actually, this list of mine has a field called…
-
1
votes1
answer115
viewsStore contact information on android Xamarin
void button_Click(object sender, EventArgs e) { //Create a new intent for choosing a contact var contactPickerIntent = new Intent(Intent.ActionPick,…
-
1
votes0
answers652
viewsSystem.Invalidoperationexception
I have to convert a datatable to XML. My datatable has 68256 lines. When I serialize to XML, I get Outofmemoryexception: Exception_wasthrown error. Follow the code I’m using to make the conversion :…
-
1
votes3
answers495
viewsSend email asynchronously Asp.net mvc
I have a return form Actionresult who sends an email after completing the operation. I would like to leave this asynchronous email, because it takes a lot of time, I tried to put in a Task using the…
-
1
votes1
answer101
viewsHow to Batch Generate Excel Files in MVC?
I need to generate separate excel files. I tried to do in a foreach foreach (var item in listExtracts) { DataTable table = Mytable; var grid = new GridView { DataSource = table }; grid.DataBind();…
-
1
votes1
answer77
viewsHow to put a form inside a tab?
I want to add a form inside a tab, I have tried using the command "this.tabPage1.Controls.Add(new Form1);" and it did not work, how to proceed?
-
1
votes2
answers169
viewsC# ASP.NET - Get last value from a Stored Procedure Parameter
I have a Stored Procedure which inserts different fields. But however there is that when inserted I want to pick and place on the screen. It is entered into the database in the following way:…
-
1
votes1
answer496
viewsMap class with json.net
Is there any way to map the properties name of a class without using the Annotation JsonProperty of Json.NET? The following structure shows two classes that inherit from the Bar class. However, the…
-
1
votes0
answers21
viewsError calling route Debugger
I installed Route Debugger via Nuget: Install-Package Webapiroutedebugger. When I run my app, and I call the Bugger a route(http://localhost:9078/Rd), this way, explodes this error: But the…
-
1
votes2
answers1138
viewsSend Boleto.net by email
I have a console application that every day at dawn should send billets to customers, access and return BD ok, the system returns a list with all customer data/ Boleto, in the example of the code:…
-
1
votes2
answers2820
viewsHow to generate an array using Random to assign values, but make it never repeat values?
I’m working on a Bingo in C# for a facul work and need to make a vector of so many values and make it never repeat this values, I am using the following procedure to generate the values of draw ↓…
-
1
votes1
answer1012
viewsHow to know which keys are pressed in C# Consoleapp and set events
How can I "read" which key is pressed and set an event for such a key if pressed. Example: if you press F1 Sum, F2 subtracts and so on I found this example on the C# help site, but I didn’t…
-
1
votes1
answer173
viewsInner Join in tables 1 - n
I have two tables: Vehicle and Images, where a vehicle can have n images. When performing an Inner Join I get the following result: Vehicles1-Addressimage Vehicles1-Addressimage…
-
1
votes1
answer36
viewsRelease of the datagridi dviewr gridi on the change button
Good morning, I have a question, I have a datagridviwer, I unchecked the option to change the fields, and I need to do that when the user clicks the change button I free the grid for change, how can…
-
1
votes0
answers24
viewsReturn an array of values from checkboxes to the controller
I have a problem returning values from my checkbox list, the "checkedcatechesis" array does not reach my controller. Script: <script> $(document).ready(function () { $('[key]').change(function…
-
1
votes1
answer134
viewsElapsedeventhandler syntax in System.Timers.Timer
There’s a difference between starting a Timer thus: _timerExam = new Timer(); _timerExam.Elapsed += new ElapsedEventHandler(OnTimedEvent); _timerExam.Interval = 1000; _timerExam.Start(); And so?…
-
1
votes2
answers417
viewsError deleting directory(file being used)
I am compressing a folder and after that deleting the folder that already existed. The problem is that in some situations I fall into an exception stating that a folder file is still being used:…
-
1
votes1
answer259
viewsPass/Receive <List> between pages and fill listview C# Windows Phone 8.1
I am creating a small application for windows phone 8.1, in which the user selects as many checkboxes as necessary, and from that the app goes through in a loop all the checkboxes to check which are…
-
1
votes1
answer51
viewsExit from my service does not match my dto
On my way out of service to the Dadositens camp, I have this: <DadosItens> Qtde 3 Custo 46,66Unitario 68,58 Margem 0Ult.Cond 30/01/2017 C. Diario 46,66 Total 205,73 </DadosItens> Turns…
-
1
votes2
answers99
viewsDoubt REST - POST
I wonder if it is possible after the resolution of the Promise of a POST if I can get the result and turn into an array Ex: axios.post(http://localhost:5000/api/horario/,{ Nome: nome, Horario:…
-
1
votes2
answers100
viewsDo you need to use Appcompat and Support Design libraries when the minimum API is 21?
I recently updated an application I am developing to use minimum API 21 (Lollipop), before it was on 19 (Kitkat). In the case of Kitkat I needed to use Appcompat and Support Design to take advantage…
-
1
votes0
answers685
viewsPerforming a SELECT through C# for an Access database
private void button1_Click(object sender, EventArgs e) { OleDbConnection Con = new OleDbConnection(); Con.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data…
c#asked 8 years, 6 months ago Nilton Guilhem 11 -
1
votes1
answer86
viewsCurrentitemchanged event of a Bindingsource is not called when changing a subitem
I got a class like that: public class Foo { #region Construtor public Foo() { } #endregion #region Propriedades public virtual int? Id { get; set; } public virtual string Description { get; set; }…
-
1
votes3
answers236
viewsCompare two querys
I have a query that returns only the catechisms that went to the event: var catequizandosCheked = (from cat in db.Catequizando where cat.Eventos.Any(e => e.EventoID == eventoID) select new…
-
1
votes0
answers216
viewsAutomapper with related entity
Good afternoon, How to map the following entities public class Artista { public Artista() { ArtistaCategoria = new List<ArtistaCategoria>(); } public int ArtistaId { get; set; } public string…
-
1
votes2
answers385
viewsHow to call a form from another project in Webforms?
I have two Webforms projects one with authentication and one without. I need to call a project form without authentication in from the project with authentication. How do I?
-
1
votes1
answer1534
viewsReference with a yellow triangle, what does it mean?
When you have an exclamation, I understand that the reference is in trouble and needs to be removed/reinstalled. But with this little triangle, I don’t know. I saw that the package is installed. In…
-
1
votes0
answers1111
viewsUnable to load file or Assembly 'Interop.Micropoint_ip_realtime'
I’m with the ERROR below when running the project in Debug(in Release works normally): An unhandled Exception of type 'System.IO.Filenotfoundexception' occurred in Slim.exe Additional information:…
-
1
votes1
answer185
viewsClass declaration in C#
What other access levels can I declare a class in C# besides public and private. I found these levels in the microsoft website: protected internal protected internal…