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
answer63
viewsOnserverclick is not running
I am trying to create dynamic buttons to delete users from a database but onserverclick simply does not run the function. This is my code so far: yourHTMLstring += "<td>" +…
-
1
votes1
answer111
viewsProblems Converting Session to Class in C#
I have the following variable List<MyFile> xmlDisponivel = new List<MyFile>(); This variable is a list of the following class public class MyFile { public string FileName { get; set; }…
-
1
votes0
answers39
viewsModel Dinámico
Good morning! I have the following problem, I need to create a model with fields whose values and types are defined in the result of using another model. I wonder if it is possible this, basically I…
c#asked 5 years, 6 months ago user149117 11 -
1
votes1
answer1044
viewsConvert Html to readable text using MVC C#
I have a text in the database like this: Example only: <ul> <li><strong> asdsdasdadsdadsa <em>asdsd asdsdasdasdad</em></strong> <table border="1"…
-
1
votes1
answer81
viewsForce Field Attribute C#
Guys I have an Attribute class being her: class TipoServicoAttrib : System.Attribute { public TipoOperacaoEnum TipoOperacao; public int CodigoOperacao; } I need that when I use, it is mandatory to…
-
1
votes2
answers87
viewsHow to pass data from select to an array
How to save the select data down to an array SqlConnection conConexao1 = clsdb.AbreBanco(); SqlCommand cmd1 = new SqlCommand("select id, tamplete1, tamplete2 from usuarios ", conConexao1);…
-
1
votes0
answers61
viewsHow to Truncate decimal values in C#
I am trying to truncate the values (without rounding) according to the number of decimals passed per parameter, but the Math.Truncate function does not have this feature... Is there any way I can do…
-
1
votes1
answer122
viewsHow to change the Datatime format in C#?
I get a string with the date, put that string in a DateTime, and put this DateTime in a bank variable. The problem is that the database variable uses a different format than DateTime (Mmddyyyy), and…
-
1
votes2
answers184
viewsDDD Automapper with Linq Expression
I have a problem with automapper, when I pass a parameter in Linux Express, it seems that it does not make the exchange... decimal valor = 13; var model = service.Obter(x => x.DataRegistro == new…
-
1
votes2
answers993
viewsHow to convert a string array[] to an integer array int[]
What is a simple way to convert a string[] array to an integer array[] string[] arrayString = new string[] {"10", "20", "30"} To: int[] arrayInt = new int[] {10, 20, 30}…
-
1
votes1
answer366
viewsError in running update-database Migration
I am trying to run the creation of my database, but I am getting this error below and am not understanding the reason: The type 'Client' cannot be Mapped as defined because it maps inherited…
-
1
votes2
answers70
viewsChoose path index
Hello, I’m with a project . NET Core Razor. My page index is inside the folder Pages, and I would like to put my page index inside the Test folder that is inside the pages folder, for example…
-
1
votes1
answer153
viewsIs there a reference for system.web in Asp.net core 2.1?
I’m setting up a Helper and need to use Httprequestbase on Asp.net core, but I can’t find a reference How could I add ? Thanks
-
1
votes1
answer237
viewsEmpty Multipart/form-data (ASPNET CORE)
I am trying to send files to my api via 'POSTMAN', but when the request arrives at the API endpoint 'Iformfile' always comes empty. POSTMAN Controller [AllowAnonymous] //utilizada apenas para teste…
-
1
votes1
answer330
viewsAdd column to a table (foreign key) using Entity framework
I have a project in c# in a relatively advanced phase. My comic book already contains some test data. I am using code first Migrations from Entity Framework I have the Users and Images tables. The…
-
1
votes1
answer73
viewsHide form using F1 key C#
I have form more precisely a menu of options and wanted to hide that form when I press the key F1 and show when to squeeze F1 again. I tried to follow this tutorial of the link that uses hook…
-
1
votes2
answers730
viewsClass with method to change a parameter
I have a User class with private attributes like Nome, Endereco and Telefone. This class has a constructor method that takes parameters such as nome, endereco and telefone. I would like to use a…
-
1
votes1
answer43
viewsWhat is the Difference between Rebin and Databind?
My question is about c#. Would you like to know the difference between Rebind and Databind? which is very specific! 'Cause I search the sites and I never see an answer that goes straight to the…
c#asked 5 years, 5 months ago wallafe sousa 107 -
1
votes2
answers154
viewsExplanation in constructor method
I have some questions about the method of constructing a class that I am seeing as an example, if anyone can explain thank you. private static IList<Categoria> categorias = new…
-
1
votes0
answers159
viewsSocket between C++ and C#
I’m facing a problem. I have the server code done in C++, running in Ubuntu. And I have the client code done in C#, running in windows. In the server code (C++) I came across a problem //recebe…
-
1
votes2
answers44
viewsReturn the Dbquery property name using Generics
How do I get the name of the property DbQuery using Generics? I have the property: public DbQuery<Pessoa> ConsultarPessoas { get; set; } And in my repository:…
-
1
votes1
answer1391
viewsSave data from a textbox to a class and display on a datagrid
I am making a program for simple registration, without using database, only with array. The program was already functional when I noticed that the most important part was wrong because I had not…
-
1
votes1
answer175
views -
1
votes1
answer53
viewsData query in a datagrid (registration program)
The problem I’m having is that I don’t how to display in datagrid only the name of the users to be possible to query each registration in this database when selected, and then displaying all that…
-
1
votes0
answers589
viewsInvalid length for a Base-64 string or array of characters. Error when decrypting String
I need a help, I’m using an encryption code and when logging in returns this error: 'Invalid length for a Base-64 string or character array'. Encryption code: using System; using…
c#asked 7 years, 8 months ago Silayne do Rosrio Noronha D As 11 -
1
votes2
answers264
viewsSQL syntax error when updating a record in C#
When I run my program to update a record, I get the following syntax error But my SQL syntax is correct: string comando = "UPDATE cliente SET nome = '" + dto.Nome + "', SET email = '" + dto.Email +…
-
1
votes1
answer184
viewsWould it be right to use a static class to consume a web service?
A question that occasionally arises when I am programming is related to the use of static classes. To official documentation Microsoft says the following regarding static classes: A Static class can…
-
1
votes2
answers907
views -
1
votes0
answers41
viewsView 3D object in Windows Form C#
Good morning, I’m trying to insert a 3D object into my Winforms C#. I researched and apparently the easiest way would be to use a WPF control. How can I integrate the WPF control into my Winforms…
-
1
votes1
answer86
viewsCopy and paste string without mask
I’m using a MaskedTextBox containing a mask of CNPJ (00.000.000/0000-00). But I wish that when I copied this string it would come to the clipboard without the mask, to remove the mask I’m doing…
-
1
votes0
answers68
viewsException Treatment Does Not Work
When I enter letter in txtIdade, the program should return the exception message. But does not return, Visual Studio informs that there is exception without treatment. try { var conn = new…
-
1
votes3
answers154
viewsHow to "mount" a multiple variable?
Would it be possible to mount a variable to pass a value to it? For example: var teste0 = "valor"; var teste1 = "outro valor"; var teste2 = "mais um valor"; for(int i=0;i<3;i++){ teste+i = "mudou…
-
1
votes1
answer231
viewsDatarow.Delete() command by unknown Row index
To remove the Row of a dataGridView using DataTable I can use the command DataRow.Delete() but, for example, in the code below it excludes a Row already known, and in case I need to remove the Row…
-
1
votes0
answers61
viewsEntity Framework 6 return cast error
I have two entities that inherit from the same abstract class. public class Empresa : PessoaJuridica { private Empresa() { } public Empresa(string CNPJ, string RazaoSocial, Status Situacao, byte…
-
1
votes0
answers75
viewsCommunication with jwt between two APIS
Staff would like a recommendation: I own an angular site that communicates with an API[API 1] Asp net core and authentication is done via jwt token. This API communicates with another API[API2] also…
-
1
votes0
answers18
viewsHttpmessagehandler vs Delegatinghandler
DelegatingHandler inherits from HttpMessageHandler. But I did not understand the difference, since it is necessary to implement the same method: SendAsync, to perform the same operation. What’s the…
-
1
votes1
answer536
viewsshow Exception error on return of AJAX call
I have this call ajax: $.ajax({ method: "GET", url: "/Shipper/getFullAddress", data: { postalCode: value }, dataType: 'json', success: function(data) { $('#AddressStreet').val(data.AddressStreet);…
-
1
votes0
answers84
viewsObject-oriented unit test
I’m trying to perform an object-oriented unit test, and the same is saying that the object was not instantiated. Follows the code: [DataSource("Microsoft.VisualStudio.TestTools.DataSource.XML",…
-
1
votes2
answers262
viewsAdd value to a string list
I have a class, and in it I have a List<string> and I just create it to add the values elsewhere. But when I try to add a value, I get the following error: Nullreferenceexception: Object…
-
1
votes2
answers57
viewsHow to insert separate data?
I want to insert data into a table in the database, but there are no mandatory fields, how should I proceed with this, because I can’t perform the command this way for example: MySqlCommand command…
-
1
votes0
answers449
viewsUnexpected fault. System may be momentarily unavailable or a point error has occurred
I am researching to develop a facilitator of consulting notes tax Nfe Fazenda site, so that the recipient can consult and download. I created a requisition GET bringing the captcha to use the site’s…
-
1
votes1
answer126
viewsPassing value from a label to Arduino via serial
I have developed a Windowsform that contains a label that checks CPU usage and displays its variations, and a button that connects the software to the Arduino in the available serial port. I also…
-
1
votes1
answer139
viewsApplications Genexus + IIS 64 Bits
Good morning, good afternoon, good evening friends. I am using Genexus to generate an application and I have some large dlls, whose routines take time to open the first time and the second already…
-
1
votes1
answer209
viewsSearch Widget for <Value> Selenium
I am developing an automation and the site does not define me something standard element, and its class is used in other elements so I would like to search it for its value. it is possible? <span…
-
1
votes0
answers29
views0 Double left, c#
Hello, I’m doing the following: Fun_CPF = Convert.ToDouble(FuncionarioViewModel.Fun_CPF2), CPF2 It is a string that can contain any Cpf, including Cpf starting with 0, such as 05669774144, but when…
c#asked 5 years, 4 months ago Jeff Henrique 1,020 -
1
votes1
answer65
viewsHow to send selected items from a Grid by email
I have a grid and in it I have a product listings from several different suppliers and each supplier has its ID. I would like to select the grid items and send the email to each vendor with their…
-
1
votes1
answer80
viewsDatagridview Dataset Problem [C#]
All right? I’m having trouble with the popular one DataGridViewwith data from Dataset. In my button1 i perform the search, reading and import for the DataGriView of all xml files in a given…
-
1
votes1
answer45
viewsDelete row from grid (BD) website C#
Good, I need a little help because I’m building a web page that shows BD data on a grid. I put the Update and delete button. I managed to change the BD via the web. But I’m having trouble deleting…
-
1
votes1
answer1211
viewsc# layer development (BBL, DAL, Model, GUI)
In my project I am developing in C# using windows Form Application with the pattern of development in Layers I am in doubt if this form is correct? because I’ve researched a lot about layers, but I…
-
1
votes1
answer102
viewsUpgrade from many to many with EF 6
My problem is when I try to update an entity that has a child class that in turn has other children. The structure is this: public class Diagrama { [Key] public int Numero_Diagrama { get; set; }…