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
-
4
votes1
answer238
viewsData Source - Best way to organize methods/classes pertaining to the entire table?
In my company we work with models based on the "Active Record" standard, that is, the model methods are always related to the operations of a unique database record, for example: Class User { int…
-
4
votes1
answer801
viewsHow to group items in a list with a proper condition?
I have a list with a property called tamanho which may contain two values: "M" or "I". I need this list to be random, but with a grouping condition. "M" would be half page and "I" full. That is, I…
-
4
votes2
answers282
viewsFilter string REGEX C#
I have a string that returns all the content of an html page. On this page, you have the following line: <input style="width: 2.3em;" id="nacional" value="3,48" type="text"> I need only the…
-
4
votes1
answer979
viewsFunction that converts hexadecimal to binary
Is there any function equivalent to bin2hex() from PHP to C#? I need to convert a hexadecimal to binary. I tried to use the TryParse but it hasn’t worked out.
-
4
votes1
answer51
viewsPath points in xaml
I am creating an application that will make an agent walk through an area with various obstacles as shown in the figure. The agent will walk from point S to point G, passing only through the…
-
4
votes1
answer216
viewsTranscribe SELECT to LINQ query expression
How can I reproduce the query then to LINQ expression? SELECT nome_empresa, Count(funcionarios.id_funcionario) AS qtdfuncionario, Count(id_colaborador) AS qtdcolaboradores FROM empresas JOIN…
-
4
votes1
answer133
viewsHow do I get a scrollbar to follow the last comment on a listbox in C#?
I am creating a Chat on C#,which will serve as an interaction between a User and an Analyst,being as a means to a Service Order,so far I am managing and I have managed to make sure that there is the…
-
4
votes1
answer3333
viewsError while consuming Web API
Hello, in an ASP.NET MVC web project I am trying to consume an API that is a Web API project, the two applications are running on the same server. When I access the MVC application error occurs when…
-
4
votes2
answers17227
viewsUnable to load file or Assembly 'Webgrease, Version=1.3.0.0, Culture=neutral
I am just opening a new project based on MVC 5, framework 4.0, c#, and after opening the project for the first time and compiling, error occurs Não foi possível carregar arquivo ou assembly…
-
4
votes1
answer190
viewsAdjust height is width of Qr Coder using Messagingtoolkit.Qrcode C#
Is there any way to adjust the height is width? thanks public void GerarQrCode(string NomeImagem,string Data) { QRCodeEncoder encoder = new QRCodeEncoder(); Bitmap img =…
-
4
votes2
answers1229
viewsImprove code performance in C#
I’m doing some tests with some C# codes and during an analysis I realized that some high-peak problems happen when integer value conversions occur to string, in the vast majority the conversion…
-
4
votes1
answer210
viewsTable relationship - EF
Good Afternoon! I have the "Service Order" and "Attachment" tables. In my "Service Order" table, I want to be able to attach the scanned service order and be able to attach pictures of the…
-
4
votes1
answer57
viewsMultithreading problems with C#
Guys, I’m having a problem doing multithreading on a system with Kinect that I’m developing for my research project. I understood that this happens because I’m trying to access from a Thread B a…
-
4
votes1
answer4336
viewsException when it will generate bank bill with Boleto.Net
I have a system that generates Santander billets using a specific DLL that was downloaded from the internet. The name is "Boleto.net". I need to create a Bradesco ticket. I changed where I passed…
-
4
votes2
answers1697
viewsDatatimepicker display time only
I am developing an application for the reception of my work in C#. As I am still crawling in the language, I need your help. The schedule will contain the following fields: Requester Name;…
c#asked 9 years, 1 month ago user24136 -
4
votes3
answers3759
viewsUsing Token method GET Webapi Httpclient
My problem is this: I am consuming a Webapi with the method PostAsJsonAsync In this call I am receiving a Token for authentication in the ADMIN methods of an EAD platform that we are working on. So…
-
4
votes2
answers71
viewsGet null fields from the database with LINQ
I have a table of Gestor in the database where you store information of a user with Manager profile. In this table, I have two FK's: uniaoId and schoolboy. Well, that manager MUST belong to a union…
-
4
votes1
answer170
viewsHow do I send variables to another page on Windows Phone 8?
I tried to follow that method, but there is an error in Mainpage, saying that the NavigationService does not exist in the current context. In Blankpage, the same error occurs in NavigationContext.…
-
4
votes3
answers3438
viewsHow to receive a pdf file via ajax?
I am using this method to return a PDF file. It works normal if I call this action directly via URL: public ActionResult GerarProva(int idEpo, int numero, bool existeProvaGerada) { try { var…
-
4
votes2
answers849
viewsBest way to make class relationship
Hello, I would like to know what is the correct way to make relationship between classes of 1.. N and 1...1. Example: public class Pedido { public int PedidoID{get;set;} ............. } public class…
-
4
votes1
answer1060
viewsHTTP 500 error using Httpwebrequest
I come here to ask for help regarding Httpwebrequest requests. I need to get the return html of an HTTP 500 (HTTP/1.1 500 Internal Server Error) error. Could someone tell me how it could be done?…
-
4
votes1
answer502
viewsAuthenticate user efficiently and quickly (without setbacks, Identity x Manual)
I need to create a system amusing using a validation (user, password). I have experience with Webform, I started already studied a little MVC but still don’t feel safe to create a complete…
-
4
votes1
answer288
viewsCreate unique attribute beyond Primary Key in code-first
I’m creating a table of Logradouro where the countryside CEP is not the primary key, but should be unique. How do I do it using code-first in the Entity 6.0? To create primary key I use the method…
-
4
votes1
answer116
views'System.Stackoverflowexception' When running Migration with Dbmigrator
I have my Migration that has a number close to 6500 records like this: db.MinhaLista.AddOrUpdate(x => x.Codigo, (new MeuModel { Codigo = "ABC1234", Nome = "Teste "})); However while running my…
-
4
votes1
answer157
viewsLibrary equal to C# 6.0 runtime Interpolation string
Does anyone know of a library that interpolates at runtime on strings? I know it could be done using Replace(), but I don’t want to pass the list with all the variables. For example: Programa de…
-
4
votes2
answers605
viewsField format for saving time
Which field should I use in SQL Server to save a duration? Ex.: 2days 23H 47min 00Sec. If you have an example with Fluent API it will help a lot.
-
4
votes1
answer114
viewsTime Usage with EF 6
I have a class with the following property. public TimeSpan TempoIdeal { get; set; } Estou atribuindo esta propriedade com TempoIdeal = new TimeSpan(days: 3, hours: 15, minutes:10, seconds: 0);…
-
4
votes1
answer87
views -
4
votes2
answers331
viewsReading HTML pages with . NET Core
Next, I have a code that performs reading of a particular web page: private string GetCodePage() { WebRequest request = WebRequest.Create(URL); WebResponse response = request.GetResponse();…
-
4
votes1
answer337
viewsHow to declare an integer type variable in C#?
I’m learning C# to migrate a system in VBA to C#. I’m really enjoying the language . NET. How do I declare an integer type variable?
-
4
votes1
answer62
viewsDoubt regarding good practices with virtual properties
I have a project that contains my classes that represent my entities in my BD. So, as an example goes there: On the table Endereco, I get a FK of Bairro(IdBairro). To play better in mine POCO, what…
-
4
votes1
answer829
viewsUrl friendly in ASP.NET Web Forms
I would like to know how to make URL friendly in C# ASP.NET. I tried to use in the file: global.asax but it didn’t work.
-
4
votes1
answer425
viewsColoring words from Richtextbox
My goal is to color all the words that are inside double quotes, and the quotation marks as well! For example: "This text needs to be colored".
-
4
votes2
answers458
viewsHow to convert Camelcase to snake_case in C#?
I would like to know how to convert a string with Camelcase for snake_case in C#. For example: EuAmoCsharp => eu_amo_csharp SnakeCase => snake_case…
-
4
votes1
answer334
viewsError while trying to consume Webapi service
since this morning I try to catch a JSON that a WebAPI available. I first tried with insira o código aquiAngularjs and was not evolving, so I went to the classic Jquery/Ajax and yet I did not…
-
4
votes2
answers75
viewsHow to obtain a cookie in the Web API in a Forms Authentication scenario in Cross Application?
I have the following applications . Net: Web Application with Forms Authentication (I’m not using MVC, I use Backbone.js to call the REST API) Web API REST application sharing the same Forms…
-
4
votes1
answer1079
viewsASP.NET MVC permissions system
A long time ago I developed a system, in ASP.NET MVC, where I used the package Mvcsitemapprovider, based on it I made some modifications in Authorizeattribute to perform the verification of user…
-
4
votes4
answers3096
viewsrecursive superfatorial problem
I have a doubt in the realization of this recursive function of mathematics. Calculation of the superfatorial: The superfactor of a number N is defined by the product of the first factorial N of N.…
-
4
votes4
answers872
viewsI need different ways to rearrange characters within a string, how do I do that?
I would like answers in C, C#, or just an algorithm, but preferably an implementation already in the C# language because that’s what I’m using. For example, suppose I have to find out if a number is…
-
4
votes1
answer4462
viewsChange port or something on IIS Express. Is there a way?
How can I change a port or something in Visual Studio 2013’s IIS Express.
-
4
votes2
answers216
viewsView Model should have related classes?
I have three entities: Manager, PersonalData and Address. A Manager has a PersonalData and a PersonalData has a Address. My doubt lies in the time to create the Viewmodels, I would have to have…
-
4
votes1
answer532
viewsIn C#, how to use the pluralize method in Portuguese?
in a C# application I’m looking to pluralize some words in English. But apparently there is no native support for en-BR. var pluralizador =…
-
4
votes2
answers1008
viewsRedeem code from an executable program?
I created a program to present in high school, but due to problems on my hard drive, I lost his code and only have the executable that I created to present it. Unfortunately, I also need the code…
-
4
votes1
answer415
viewsStatic public variables in C#
How can I organize my code? When programming there are variables that I am leaving in the same code at the top as: namespace myData.MySql { public partial class teste { public static string…
-
4
votes4
answers5878
viewsConvert String to Decimal
And I’m having trouble properly converting this string in decimal. decimal.Parse(txtValor.Text)=meuVen.Valor; When I put the conversion in front, it shows error after the =. I don’t know how to…
-
4
votes1
answer1153
viewsGet information from a div in C#
Well, I have a code that reads the page but I need the following: <a href="/t848p15-teste">2</a> The idea of the code is to look for a tag <a> that has this 2 and return the link.…
-
4
votes1
answer151
views.Net Reflector compilation errors
I’m studying C# and I’m trying to learn a little reverse engineering. I’m making the following mistake: private void button1_Click(object sender, EventArgs e) { this.Result = true; this.ConfigName =…
-
4
votes2
answers882
viewsWhat is the importance of using java interfaces or c#?
I know how to implement and use interfaces, but I can’t understand what the real reason for them is in c# or java, since once you extend your class to an interface you need to implement all the…
-
4
votes2
answers447
viewsHow to adapt / create a method that receives an anonymous class in C#
I have a method in which one of the parameters is an object of an abstract class - Objectmapper - whose purpose is to convert an object of one class into another of another class. Below, the method…
-
4
votes2
answers817
viewsCheck if string starts with number
I need to check if a string starts with numbers. I want to do this using Regex in c# public static class StringExtensao { public static bool ComecaComNumero(this string str) { if…