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
answer136
viewsC# - How do I check if 2 arrays have one or more numbers in common?
How do I find that in the numbers of 4 Textbox that are in the array numeros, are on the array impares or pares, what are these numbers and how many are odd and how many pairs? int[] numeros = new…
-
1
votes1
answer31
viewsContextcompat.Checkselfpermission . NET Standar 2.0
I’m racking my brain and looking for a code example that asks for permission to some feature (camera, GPS), and everyone I meet makes use of Contextcompat.Checkselfpermission, but the…
-
1
votes1
answer301
viewsHow to work with anonymous guy
I have the following code snippet: var filter = new { categoria = 1, cond2 = foo, ... }; p = new ProdutoBusiness().listarProdutos( filter ).ToList(); I wanted to work with this anonymous type as a…
-
1
votes2
answers778
viewsHow do I change the content of a Usercontrol using a button in another Usercontrol?
A window with a grid, and with two content areas, "Contentarea" and "Contentmenu". "Contentarea" starts blank, "Contentmenu" starts with the Navigation buttons, which make "Contentarea" change its…
-
1
votes1
answer153
viewsMVC in C#, separate by folders or class library?
I saw some examples that separate by folders, and others that separate by a class library and then create the note in the references. Both forms can be used?
-
1
votes1
answer48
viewsHow to show queries generated by EF core
A while ago, with a simple code within my context, I would show the queries generated by EF6 on the console or even write to a txt file... However, today I use Entity Framework Core, in an Asp.net…
-
1
votes1
answer971
viewsManipulation of TXT files in C#
I am working on a project where I need to do User Registration and Control from an initial user (administrator). In my file I have the following line containing all user information and in the…
c#asked 7 years, 11 months ago Paulo Sardinha 11 -
1
votes2
answers2589
viewsCannot implicity Convert type 'System.Collections.Generic.Ienumerable' to 'System.Collections.Generic.List'
I have the following method below for the purpose of returning notifications that must be displayed to a particular customer and notifications that must be displayed to all customers. public…
-
1
votes1
answer279
viewsBold highlight a concatenated item
I would like to highlight in bold a part of the text that is in the Displayalert notification. DisplayAlert("Alerta", "Deseja realmente incluir o lance de valor de R$ " + EntryLance.Text + "?",…
-
1
votes1
answer1631
viewsError opening connection to SQL Server 2008 R2 database
I’m having a problem opening a connection to a local database in SQL Server 2008 R2. The opening method that is giving error is as follows: public static SqlConnection AbreConexao() { string path =…
-
1
votes1
answer67
viewsHow to load a Partialview to create a comment
I am working on a project to learn ASP.NET MVC and Razor. Right now I have a model of post with a view, and a view associated with model class comment to create a new comment. I wanted to know how…
-
1
votes1
answer54
viewsIncrease field size varchar (existing in database) with Nhibernate
Let’s say that this field with size 11 exists in the database, in several clients.. Map(x => x.CpfCnpj).Not.Nullable().Length(11); And one day I need to increase it to . Length(14). Is there any…
-
1
votes0
answers29
viewsExport BD content to a WORD table
Well, I was doing a job and I came across this situation: I need to export certain content to Word, but this content must be in a table of the same. How could I do a While to create the Rows and…
-
1
votes1
answer265
viewsPass ID to Controller
I have the problem that when I click on the Register button, the City does not pass the ID. I did. The ID is being passed to the screen, but when passing to the controller is not. <div…
-
1
votes1
answer101
viewsSave xml as UTF8
I’m consuming a Webservice, where the return is an XML. Save XML in a directory for another system to read. How do I save this XML as UTF-8? The other system read the content but the special…
c#asked 6 years, 1 month ago João Bosco 41 -
1
votes2
answers101
viewsEF relationship
I know it’s something basic, but how do I make a relationship between Entities using the Entity Framework? I have the Competition table and the Competition table. The Competition table must have an…
-
1
votes1
answer593
viewsPagedlist: Data Pagination with Ajax
I’m using Pagedlist with Ajax, but I can’t change the page because when I click on the button, which represents the page, the value that is going to the controller is null. I made the following…
-
1
votes2
answers393
viewsMessage to the user in Label with Jquery
I’m validating the registered user’s email, and I want to display the message to him if the email already exists, so I did so: //validação de email $(function validateEmail() {…
-
1
votes2
answers682
viewsExtract XML C#tags
I was able to get a tag, but I couldn’t find a way to take a tag that repeats itself and store each repetition in a list. XML example <casa> <porta> <janela>Janela 1</janela>…
-
1
votes3
answers145
viewsAvoid editing in the field
I am trying to do the following: the user type his zip code, and then it is filled automatically, estado(select) cidade(select), rua(input) and bairro(input), when the user enters his zip code and…
-
1
votes0
answers107
viewsProblem with Oauth2 JWT in Webapi2
Basically all code is working, I can generate my token, I can do everything, but I’m not able to validate the token. My code is like this when I call the api. What happens is: I’m sending the…
-
1
votes3
answers73
viewsHow to create a class with type inference that can have a default type in C#
I’m creating a class where I make type inference, as in the example below: public class Foo<T> { public T Bar { get; set; } } Is there any way I can set T to a default type like string? My…
-
1
votes1
answer65
views -
1
votes2
answers160
viewsDecrease Field Size Edit
good morning. I’m beginner, I’m trying to decrease the size of the column edit and I’m not getting as the image below. Can someone help me? <thead> <tr> @*Campo Nome*@ <th…
-
1
votes1
answer87
viewsAutomapper with Ioc
public class Vigencia { public DateTime DataInicialVigencia { get; set; } public DateTime DataFinalVigencia { get; set; } public Guid VeiculoId { get; set; } public Guid RastreadorId { get; set; } }…
-
1
votes1
answer783
viewsPopulate chart with mysql data
I am developing an application in C# and need to fill a graph with the amount of data registered in 3 Mysql tables. It is as follows: The graphic should inform the user in different columns how many…
-
1
votes1
answer93
viewsRepeat Stacklayouts according to Xamarin Forms list
I created a StackLayout with a labels inside that I need to display some information on them. With that, I need it charged StackLayouts and completed the labels according to the amount of records on…
-
1
votes1
answer79
viewsHow to check and uncheck the Telerik component Checkbox?
I searched the website of Telerik and not found where it shows how to do to enable the Checkbox (mark and unmark) of this component ? 'Cause I’m gonna need to update the profile by sending it to the…
-
1
votes1
answer678
viewsFill class with bank result
Good afternoon everyone. I have a huge need to be able to put together a situation. I have an object DataTable with the result with the column "ID_CLIENTE". I have an object Cliente with the…
-
1
votes0
answers64
viewsColliders on Unity3d on C#
I’d like to detect if my cube on the left is touching the side of my cube on the right, but I can’t do that. Is there any method without having to create null objects, raycasts or linecast that can…
-
1
votes1
answer241
viewsAccent problem when running python script straight from C#
I’m using this to run the code: processo.StartInfo = new System.Diagnostics.ProcessStartInfo { FileName = @"\Python27\python.exe", Arguments = arquivoResposta, UseShellExecute = false,…
-
1
votes1
answer68
viewsTcpclient only receives the first message while connected
I’m developing a program for hobby, in order to understand how the TcpClient. Well, I am doing a program that from time to time receives a package from a secondary program and sends an OK back,…
-
1
votes2
answers61
viewsVariable keeps zeroed in a mathematical expression
My little show is like this: public void CalculaProporção() { decimal contagemSubida = 0 , contagemDescida = 0; int cSubida = 6, cDescida = 4, range = 10; contagemSubida +=…
-
1
votes1
answer68
viewsError when registering user
When I try to create a second user, with ASP.NET MVC, presents me with a mistake: Violation of PRIMARY KEY Constraint 'Pk_dbo.Aspnetusers'. Cannot Insert Duplicate key in Object 'dbo.Aspnetusers'.…
-
1
votes0
answers32
viewsHow do I save my game menu (C#)
Hello, I’m having a little problem when it comes to saving the settings in my game menu, the resolutions and quality when pressing the save button, it saves. the problem is that I made a button that…
c#asked 6 years ago Gustavo Bianco 51 -
1
votes1
answer445
viewsHow to get the exact value of the division with the decimal places after the comma?
I need to do a percentage calculation, but I’m not getting the exact amount. Example: int valorUni = 8; int valorTotal = 116; double result; result = (valorUni / valorTotal) * 100; //Resultado…
-
1
votes1
answer54
viewsDisplayname does not work in relationship
have a model: public class TalaoCode : ITalaoCode { [Key] public int TalaoCodeId { get; set; } [DisplayName("Equipe")] public int EquipeId { get; set; } [DisplayName("Equipe")] public virtual Equipe…
-
1
votes1
answer2168
viewsHow to open page in google Chrome ultilizando C#
I need to open a window using c# with a specific web page in Google Chrome (Not in the default browser). A possible solution would be to run a C#Cache, but I don’t know how to open only in Chrome.…
c#asked 6 years ago Jaffe.Marques 561 -
1
votes0
answers39
viewsTcpclient or socket class ? c#
First doubt Half turned to emulator’s I wondered if the Tcpclient or Socket class would be good in terms of network and quick responses? Second doubt I use Tcpclient But when I write a reply using…
-
1
votes1
answer31
viewsItems are not shown in dataGridView
I am using the following code to include items in a list and show them in mine DataGridView: PedidodetalheOffline item = new PedidodetalheOffline(); //crio um novo item item.IdOffline = id; //seto o…
-
1
votes0
answers241
viewsFtpwebrequest - Error large files
I have a c# desktop application running a few months on a client. The same requested a module to perform uploads and downloads on an FTP server, the database is currently in the clouds by Kinghost,…
-
1
votes1
answer247
viewsHow does the Dependency Property (Dependencyproperty) "work"?
I’m trying to understand the feature of dependency properties. I’ve read some tutorials on msdn but the feature is still unclear to me. Example: using System; using System.Collections.Generic; using…
-
1
votes1
answer55
viewsDoes Visual Studio open existing code when I click NEW project?
I started learning C# and I’m using Visual Studio. I created my basic "hello world" program, saved the project. So far so good, but when I open a NEW project, in order to create a new code, it pulls…
-
1
votes3
answers124
viewsUse of "Contains" in search expression
I have a string _Users of the kind List, it contains several lines. Each line consists of an integer and a string separated by comma (in general it is only one string): ID (numbers only),name…
-
1
votes1
answer45
viewsHow to make a LINQ query that returns the amount of people who were born per month?
I would like to make a LINQ query that returns the amount of people who were born in the month. In Mysql I do this query: SELECT COUNT(*) AS DataNacimento FROM pessoas WHERE MONTH (DataNascimento) =…
-
1
votes1
answer39
viewsSystem.Runtime.Remoting.Remotingexception no Designer XAML VS2015
I have a problem in Visual Studio. When I create a new UWP10 project in white, it comes the basic code. <Page x:Class="FoxMovieStoreMain.MainPage"…
-
1
votes1
answer43
viewsShow help button when text box is selected (C#)
I’ve been looking for a while about how to put a help button that only appears next to the text box when it is selected. Is there any way to do it in the c#? This should be the case when the text…
-
1
votes2
answers448
viewsSQL Injection or Script Injection - MVC-5 - Is it a concern?
I am developing an application in MVC-5 and read several articles about SQL Injection. I wonder if I have to take any security measures or modify my selects commands, or if in fact the MVC-5 already…
-
1
votes0
answers194
viewsMysqldataadapter Fill giving error
When using database connection in C#, I saw many ways to do. I can insert data into the database very smoothly, but the selection of data is making me gray. Below the code and soon I will explain…
-
1
votes0
answers24
viewsOperator => in C#methods
I have the doubts: Utility and operator name in bold below? private double ConverterRadianos(double dblValorAngulo) **=>** (dblValorAngulo * 0.0174532925);
c#asked 5 years, 11 months ago Marcos Wilian 13