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
answer74
views -
1
votes1
answer459
viewsINSERT in batch c#
I would like to know if it is possible and how to perform an INSERT in the database of 10 equal values and adding 1 more in a field.. ex: I have an equity system and I need to register 10 identical…
c#asked 6 years, 9 months ago dionebravo 13 -
1
votes2
answers120
viewsLambda expression to return a Person in the repository - DDD and Aspnet.Core
I have a table Person who has one-to-one relationship with the tables PessoaFisica and PessoaJuridica. When I pass the id, it has to check me if nature is physical or legal and bring me the person +…
-
1
votes1
answer4081
viewsRoot and power in C#
I need to calculate the root and power according to the logic that follows.. so far ta funfando using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using…
-
1
votes1
answer216
viewsDoubt in Asp.Net Core Identity’s Verifyusertokenasync method
I have a question about Verifyusertokenasync of Asp.Net Core Identity If the user forgets the password, I provide a page to indicate the email and send a url that has the Userid and Token (in the…
-
1
votes1
answer97
viewsProblem saving
Only a form that is returning me this mistake, the question that I do not know what can be or how to fix, some ask to cascade the relationship that is already. Nhibernate.Transientobjectexception:…
-
1
votes1
answer401
viewsLog in Separate Files [Log4net]
I use Log4net in my application. I need to create a configuration that "deposit" everything from level="INFO" in a file and everything that is light="ERROR" in another file. But even following the…
-
1
votes1
answer96
viewsHow to make a Custom Attribute in a webapi get the parameter passed via C#URL
I am creating a Custom Attribute in a webapi to validate a value and I would like to know if you can capture this value from a GET request. I wanted to do it that way: [Validacao] public Empresa…
-
1
votes1
answer92
viewsHow to assign a database value to a new object in C#?
I’m creating an app like a bench to train C, but I ran into a situation. I have a database with the tables Accounts, Clients and Tiposconta. In the table Tiposconta there are registered the item…
-
1
votes0
answers85
viewsError on Android and iOS platforms, Httpclient.Getasync(Uri requestUri) function redirected to URL
I am developing a Xamarin Forms application that basically uses the Getasync function through Httpclient(Uri requestUri): HttpClient httpClient = new HttpClient(new NativeMessageHandler()); var uri…
-
1
votes1
answer217
viewsComparison of Dates c#
My question is this:. I need to display 2 status on a page that would be Primeiro and Alterado, where the first sql line with the date of 2018-03-05 10:24:55.787 get the status Primeiro and the…
-
1
votes1
answer314
viewsProgress bar in second window
I’m creating a system that takes files from a server and copies them to my machine. I work in a software company and as we can not install systems from outside, I decided to create the own. The…
-
1
votes1
answer132
viewsIs it possible to apply CSS style in email sending method?
I have the following method that sends a password recovery email to the user. I wonder if it is possible to apply some type of CSS formatting in it, in order to make more attractive the sent email.…
-
1
votes3
answers363
viewsI cannot use the Find() method using Entityframework
I’m using the following tutorial to use the Repository Pattern: Follows my repository class public class Repository<T> : IDisposable, IRepository<T> where T : class { protected readonly…
-
1
votes1
answer2592
viewsError converting Base64 to String
I have a Base64 string but the C# compiler says it is not valid, I get the following error: The entry is not a valid Base 64 character string, as it contains a non-base 64 character, more than two…
c#asked 6 years, 8 months ago Leonardo Bonetti 5,313 -
1
votes1
answer659
viewsPass view bag value to view
I’m trying to pass value from a view bag to the view create. Controller public ActionResult Create() { ViewBag.BanhoTosaId = new SelectList(db.BanhoTosas, "BanhoTosaId", "Tipo"); if…
-
1
votes1
answer1038
viewsI would like to understand what OLTP is
They asked me this question: What is OLTP? I ran home, opened google and started to "goolgar", so I came across these codes, who say they have problems in OLTP environments and I’m not understanding…
-
1
votes1
answer70
viewsHow to control events in C#
Using the "Tcplistener" class I am "listening" to a port where several customers will connect. Until then quiet. To receive data from a client I used a Thread that generates an event whenever some…
-
1
votes1
answer259
viewsXamarin - Hamburger Some Menu by clicking Back WP button
I am using the code below to create a Master Detail menu in Xamarin. The code works perfectly on Android but on Windows Phone it has a bug that I am unable to solve. Mainpage.Cs using…
-
1
votes1
answer46
viewsClass structure for
I have the following XML returned by a service: <?xml version="1.0" encoding="iso-8859-1" ?> <mensagem tipo="0000" version="1.0"> <registro tipo="0000" version="1.0">…
-
1
votes1
answer558
viewsFind out which service is being used in port tcp C#
I created a Scan Port in C# (winforms), which is checking a range of ports, previously set, I can verify that the door is open, but my problem is this: I know the door is open, but I don’t know what…
-
1
votes1
answer1749
viewsCapture IP and local machine name
I need to get the ip and name of the client’s local machine in case the user who will be accessing my system. My system is hosted on the network system and database. The commands I have used so far…
-
1
votes2
answers93
viewsHow do I prevent the file I created in txt to record two equal C#?
People to better specify my problem, it is like this: I have a system that performs barcode reading and, in this precise system that the txt file that is receiving the code does not receive…
c#asked 6 years, 8 months ago Dérick Luiz 13 -
1
votes1
answer193
viewsHow to access attributes of a JSON that has been converted with special characters?
I am consuming the API of microsoft translation, they work with the return in XML(Because it is, MICROSOFT returns XML in its API’S), I managed to run everything right, but as I hate working with…
-
1
votes1
answer115
viewsInstantiate method in Instantiated Form
Hello, I am with the following question, I have installed a new form with the following code: Form frmDialog = new Form(); Well, I want to do the following, in the form in which I instituted this…
-
1
votes1
answer50
viewsHow to open an Openfiledialog box when selecting a Tabcontrol Tab?
I would like when the user selects a particular Tab, to immediately open an Openfiledialog box. I already have this Savefiledialog, but it’s in the button click method: private void…
-
1
votes1
answer220
viewsBack Button does not appear in Navigationbar Xamarinforms
I have a Hamburguer Menu with a Listview where in the click of the listview line I call this method to open a Modal, but the Navigationbar does not appear the Backbutton. public async Task…
c# visual-studio xamarin xamarin-forms xamarin.androidasked 6 years, 8 months ago Lucas Riechelmann Ramos 521 -
1
votes1
answer329
viewsAjax in MVC - Select
I’m having a problem loading the fields select in my project. Mine Forms are all done with Razor and only the select’s(combobox) I charge by ajax. Problem: When I start the form the ajax event to…
-
1
votes1
answer154
viewsProblem changing entity with E.F and Dapper
I have a Dapper query, where I search for an entity: var fatura = ObterPorClientedEDataVencimento(cobranca.ClienteId, cobranca.DataCobranca); The method and properties of my entity are in this Gist,…
-
1
votes1
answer72
viewsRadiobutton on the Repeater?
I need to make an Oncheckedchanged on a Radiobutton inside a Repeater, but I could not do it the normal way. there is how to create an event on a radiobutton inside a Repeater? <asp:Repeater…
-
1
votes0
answers187
viewsMake sure that the controller has a parameterless public constructor
I’m getting this error after giving deploy(AWS) of my WebApi. Note: PLACE WORKS PERFECTLY. <ExceptionMessage> An error occurred when trying to create a controller of type 'LivroController'.…
-
1
votes2
answers421
viewsMy C# software with SQLEXPRESS Localdb database does not open on another PC, even installing all dependencies
1 - My C# software with SQLEXPRESS Localdb database does not open on another PC, even installing all dependencies. NOTE: My Development PC works perfectly. 2 - Programs I have already installed in…
c# sql-server sql-server-2014 sql-server-express sql-server-localdbasked 6 years, 8 months ago Dener Portela 9 -
1
votes1
answer145
viewsHow to transfer from one Combobox to another (C#)
The idea is, there is a Main Combobox, each with a customer from 4 different cities, I wanted to select a customer on Combobox, press the button and remove from this Combobox and insert in the…
-
1
votes1
answer481
viewsReturn selected object in datagridview
I have the following parameterization of my datagridview: List<ModelAluno> alunos; ModelAluno aluno = new ModelAluno(); public PesquisaAluno(List<ModelAluno> alunos) {…
-
1
votes1
answer89
viewsError doing counter via c#
I’m trying to do a pendant counter to my system, only it’s giving error, at the time of calculating, someone could help me? Error in . Count as you can see in the picture below. My Controller public…
-
1
votes1
answer82
viewsXamarin Forms is removing the space between words at runtime
I’m working on a project with Xamarin Forms Visual Studio. When running the project for iOS, it works perfectly, but when running the same project for Android the phrases appear all together. Ex.:…
-
1
votes1
answer135
viewsMessage Warning CS0108!
Because when I inherit an interface and implement the same methods I get Warning CS0108. Active A variable was declared with the same name as a variable in a base class. However, the new keyword was…
c#asked 6 years, 8 months ago Marco Souza 12,304 -
1
votes1
answer392
viewsSimpleinjector: The Configuration is invalid. The type is directly or Indirectly Depending on itself
I have the following problem when applying the Simpleinjector container in a simple application: The configuration is invalid. The type BookAppService is directly or indirectly depending on itself.…
c# asp.net-mvc dependency-injection ioc simple-injectorasked 6 years, 8 months ago Matheus Daumas 37 -
1
votes1
answer85
viewsError when calculating average
I would like to take the sum of all salaries and divide by the amount of employees, but this giving error, when I compile says that this with 0 in the variables Count of the list and total. public…
-
1
votes0
answers91
viewsHow to map a json string to another json string?
Is there any way to map a json string to another json string? The goal is to take the value of one json property and set it in another json property. Exe; I have the json. { "codigo":0,…
-
1
votes0
answers166
viewsStoredprocedure in SQL-Server passing a C#List parameter
I would like to pass a list of parameters to a precedent, how to do this process? I did some research and I thought it is possible to create a TABLE TYPE and use it in the parameters of the past,…
-
1
votes1
answer374
viewsDoubt to enter record with foreign key. ENTITY FRAMEWORK
I’m a beginner (starting bemmmm) in programming, and I have a case to develop, which would be a Crud, using Asp.net (C#) and Entity Framework. I created a simple contact registration form, where…
-
1
votes2
answers476
viewsSave/Recover Files with PDF Extension
To save files with extension PDF in the database it is necessary to do the conversion to base 64? Or would there be some other way to save this type and its recovery for viewing? The code I have…
-
1
votes1
answer3156
viewsHow to add one Form inside another?
I have two presses (FormMenuPrincipal and FormFuncionarios) in which when the button btnFuncionarios of Menu is clicked, I want to open the form Employees. I thought I’d add one panel painel as…
-
1
votes0
answers804
viewsConversion failed when Converting the varchar value '@userid' to data type int
The error is what is in the title, converting char to int. " Conversion failed when Converting the varchar value '@userid' to data type int." I appreciate any help and if you have any good practice…
-
1
votes1
answer987
viewsReinf - Event error R-5011
While trying to sign the R-5011 consultation event, I am encountering this error: "The element of thehttp://www.reinf.esocial.gov.br/schemas/evtTotalContrib/v1_03_00:nrProtEntr' is invalid - The…
-
1
votes1
answer2568
viewsString size exceeds the value set in the maxJsonLength property
I’m trying to generate a file Json from a SELECT of the SQL SERVER 2016 table. There are about 4713 rows, this is exceeds the value set in the property maxJsonLength. I can exceed that set value?…
-
1
votes1
answer1550
viewsDisplay logged-in user on C#
I was able to get the user logged in through the text typed in TextBox. But I don’t want the user, I want the username. Example database: id = 1 nome_usuario = Administrador usuario = admin senha =…
c#asked 6 years, 7 months ago Giovani Rodrigo 299 -
1
votes1
answer1816
viewsc# Json returning backslash
I’m new to the web, I’m trying to return a json but it comes with bars like this: {\"NomeUsuario\":\"TESTE\",\"TelefoneUsuario\":\"1111111111\"} How do I make him look like this:…
-
1
votes2
answers86
viewsComparison of dates with custom date class
For design reasons, the class Datetime do. NET is not suitable for me. So I decided to create my own version: public class HolidayDateTime { public readonly uint[] RangeValueDay = { 1, 31 }; public…