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
-
2
votes1
answer223
viewsLivechart - Fill Cartesian Chart with Sql Server Query Data
I have a Datacontext set in a Cartesianchart which does not display the data... no error is displayed, just think I’m making wrong use of the Datacontext and I can’t fix it, I’m using the package…
-
2
votes1
answer1353
viewsC# Decimal field accept value equal to or greater than 0 in validation
I’m having trouble validating my type fields decimal using Razor, when I try to enter 0 in the field it gives the following error message. The field XXXX must be a number. Follow down my class and…
-
2
votes3
answers878
viewsApp.config to access an SQL Server database?
How can I adjust this app.config to access my SQL Server database? <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> </configSections> <startup>…
c#asked 6 years, 9 months ago johnny nascimento 21 -
2
votes1
answer81
viewsPerform tracking and debugging on . NET
During the development of an application, there are times when I get lost and want to understand how my code is running. For example, in which iteration of a particular loop of repetition it is,…
-
2
votes2
answers351
viewsApply between in an hql in c#
I am trying to apply a between with two fields of a part of my form, are dates and vehicle ids, I do not have much knowledge of how it models this by HQL in nhibernate with c#, I wonder how it would…
-
2
votes2
answers266
viewsASP.NET Razor Pages error while processing the request
I’m implementing an example using ASP.NET Razor Pages and when trying to access the page Index I have the error that there is error in the request. Error. An error occurred while Processing your…
-
2
votes1
answer146
viewsUse variable value not yet declared. Circular Reference in c#
I know the question seems absurd but a client of mine gave me an excel spreadsheet that has a variable that is used before having its calculation defined. In excel this calls Circular Reference. I…
-
2
votes1
answer202
viewsEncrypt in UWP and Decrypt in Web API
I’m trying to encrypt a string in a UWP (Universal Windows Platform) application and decrypt the string in a Web API application. The problem is that I can’t find/modify an algorithm common to both…
-
2
votes2
answers123
viewsHelp with LINQ, query no . Net
Good morning, guys, I could use a little help with LINQ. I am trying to perform the following query through the: SELECT NFE_SAIDA.NFESAI_SEQUENCIA FROM CAD_NFE_SAIDA NFE_SAIDA LEFT JOIN…
-
2
votes1
answer152
viewsHow to change Imagebrush background?
Follows code XAML: <TextBox /> <TextBox.Background> <ImageBrush x:Name="image_background" Stretch="Fill" TileMode="None" AlignmentX="Left" AlignmentY="Center" />…
-
2
votes0
answers19
viewsHow to ensure that my Plugin will not kill my host? (C#/WPF)
Sirs, I need to build a Plugin system that meets some requirements. Ensure library isolation, for example, The host must use Mahapps Version A, and the plugin must use Version B. Should I avoid to…
-
2
votes1
answer568
viewsCheck whether a COM port is connected or not
It is possible via code line to check whether a COM port is connected or not ? Analysis: I have a program PDV(Point of Sale) where the same has the integration with Sitef, through a Pinpad(cardboard…
-
2
votes1
answer1186
viewsMultiple select list with items already selected using Razor
I’m using Razor to generate a SelectList thus: @Html.DropDownList("StatusImovel", new SelectList(ViewBag.ListaStatus, "IdStatus", "Descricao"), new { @hidden = "hidden", @multiple = "multiple",…
-
2
votes1
answer109
viewsRead and display a PDF inside a zipped folder without extracting it
Is it possible to do this or do I really have to extract the file before to later read it? In my code I’m doing so: string zipPath = @"C:\Users\Analistas\Desktop\ZipFile.zip"; using (ZipArchive…
-
2
votes1
answer257
viewsC# How to Select and Color all text within a given line in Richtextbox?
In C# I have a Richtextbox, inside it has several lines, what I want to do is select all text within a certain line and color. What I’m doing is this: richTextBox1.Select(0,…
-
2
votes1
answer791
views -
2
votes0
answers139
viewsWhat is the best technique to use Viewmodel with C#mvc lists?
I have two templates: event registration package and registration package, where the event registration package template has a list of registration packages (see code below, removed some fields).…
-
2
votes0
answers480
viewsEFD-Reinf: (500) Internal Server Error - Identifier: 3033699826
I’m trying to submit a test of Reinf’s R-1000 event and get back to me: Remote server returned an error: (500) Internal Server Error. Processing failure. Please try again. Handle: 3033699826 Could…
-
2
votes1
answer46
viewsError when simulating distinc in query with Linq and lambda Expression
I have 2 tables in a Sqlserver bank. One tbState call and another tbCity. I am trying to return all states of the table tbState that have at least one city (tbCity) and with the properties…
-
2
votes1
answer379
viewsConvert SQL to LINQ
I have the following table CREATE TABLE `ultimaposicaorastreadores` ( `Id` CHAR(36) COLLATE utf8_bin NOT NULL DEFAULT '', `Serial` BIGINT(20) NOT NULL, `DataGps` DATETIME NOT NULL, PRIMARY KEY USING…
c# sql entity-framework entity-framework-6 linq-to-entitiesasked 6 years, 9 months ago b3r3ch1t 805 -
2
votes2
answers1026
viewsThe task "Xamarin.Forms.Build.Tasks.Gettasksabi" was not loaded from Assembly
That’s the mistake I’m taking: C: meu_caminho Packages Xamarin.Forms. 2.5.0.122203 build Portable-win+net45+wp80+win81+wpa81 Xamarin.Forms.Build.Tasks.dll. Confirm that the statement is correct, if…
-
2
votes2
answers528
viewsHow to use the SUM aggregation function in a NHIBERNATE query?
My consultation consists in knowing the NumCarroId, TotalGasto and VlrUnit, in Sql I managed to do that but when I play in HQL returns the following error: Application of GROUP BY next to the SUM to…
-
2
votes1
answer412
viewsHow to replace string using another string containing Json?
Is there any way to replace a String with the fields of another string that contains a Json? Example; I got the string; String template = "Olá [Nome], Tenha um bom dia ... hoje é [Data] e é seu…
-
2
votes1
answer38
viewsError When Customizing MVC5 Routes
Error occurs in method (Registerroutes) in Routeconfig.Cs on line routes.MapMvcAttributeRoutes(); When running in the browser: * The built-in Constraint resolver of type…
-
2
votes1
answer41
viewsWhat is the property of a COM+ component "Remote Server Name"
I’m having a problem finding the name of the property of COM+ so I can change the content of it, by my researches I need to know the correct name of the value of the parameter to be able to change…
c#asked 6 years, 8 months ago Cayo Da Silva Lima 366 -
2
votes1
answer1785
viewsUrl encryption
I have a way of Email which generates a link through HTTP request, which will send to the user’s email for exchange. But for testing I fixed in this URL the user ID, but for security reasons I have…
-
2
votes2
answers77
viewsSelectlistitem with custom attributes
I created a DropDownList by the method below: private void PopulateDropDown() { //Chamo o método que obtém a lista de clientes da API List<Models.Cliente> clientes = new…
-
2
votes1
answer651
viewsError: C# The name 'Json' does not exist in the Current context
I have the following error in C# 'The name 'Json' does not exist in the Current context' in my application. I followed all the recommended steps by various websites, such as adding such references…
-
2
votes1
answer153
viewsEnable navigationbar or create a panel on top of the Xamarin.form tabpage
I have this page (Tabbedpage) that creates two tabs: <?xml version="1.0" encoding="utf-8" ?> <TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"…
-
2
votes1
answer444
viewsBlurred text when activating Canvas
Image as it should be: Blurred image after deactivating first Canvas, and activate another Canvas: I use two Canvas in the same Scene, one for the login, which starts enabled, another for the…
-
2
votes1
answer865
viewsChanging the bar color of a Navigation page
I have it: public void Login_Clicked(object sender, EventArgs e) { LoginService svc = new LoginService(); LoginRS res = svc.Login(txtUsuario.Text, txtSenha.Text); if (res != null &&…
-
2
votes2
answers265
viewsUnexpected result in using Parallel.Foreach
Next, I have a class that has a string list and the following structure public class Teste { private List<string> _codigos; public void InsertDB(string[] files) { _codigos = new…
-
2
votes2
answers426
viewsView Mapping with Entity Framework
I am doubtful how to map a View created in Oracle Bank 11G with Fluent-API. Here is an excerpt from the view with alias: tran.id_transporte AS "ID Navio", tran.ds_nome_transporte AS "Navio",…
c# database entity-framework-6 fluent-apiasked 6 years, 8 months ago Samuel Renan Gonçalves Vaz 720 -
2
votes1
answer371
viewsSelect columns with no specific name
I am developing a C# application that consumes data from a spreadsheet and at some point I need a query string that will feed a variable. For example: strComando1 = "SELECT TOP 2 ColunaGenerica1,…
-
2
votes5
answers371
viewsValidate model before inserting in the database
I am developing a Webapi using Entityframework6. Before performing an INSERT in the database, I would like to validate the model that is coming via request (I believe to be fundamental), but I have…
-
2
votes2
answers2197
viewsWhat is the most efficient way to clear a list (List) with C#?
I have a scenario here where I create a list to check some items, and I need to clear this list inside the loop, and I got some questions regarding the performance I must check the list before I…
-
2
votes1
answer54
viewsPopular the properties of a class
A question. Before the service returned values in the following signature: Planned/Accomplished, This made it much easier. Now the subscription has changed to this: { "CorIndicador":"VERMELHO",…
-
2
votes1
answer104
viewsWhy does adding a variable, property, method, etc. to a string work?
When I add a variable, property, method, enumerator, etc. into a string, it works, even though I’m not calling the method ToString() for example. Example with type and integer: var example =…
-
2
votes1
answer667
viewsActivate an object and disable others
I’m making a car shop system in the Unity engine, and I need a method to activate a type of contour in the selected car. However, I need the contour of the other cars to deactivate automatically.…
-
2
votes1
answer792
viewsEntity lambda framework with include returns empty Collection
I have a select that returns chained data and plays it in a Viewmodel created for the simple reason that I cannot return all data from my table, as in the example: var data = _context.Forms…
-
2
votes1
answer298
viewsUnity Store System
Hello. I need a way to create a car shop in a Unity game. I started to create the store, but I can’t find a way to show the car purchased in another scene, ie the game know that you bought that car.…
-
2
votes2
answers402
viewsReturn data from a Linq query to an EF Core repository
I have the Person class that relates to the Personal and Personal Tables in a one-on-one relationship. In my table Person I have the field Personnature where 0 = Person and 1 = Legal Person. A…
-
2
votes2
answers682
viewsDoubt between using composite primary key or not in the associative table
I’m making a relationship where the same is N:N... Example: Projeto x Funcionario In this relationship I create an associative table called Projeto_Funcionario leading the id of the two classes.…
-
2
votes0
answers587
viewsSystem.Speech in Portuguese-Brazil
I wonder if through the System.Speech can use in Portuguese - Brazilian. My operating system is in the English language. I already downloaded all the necessary packages, and if I put in the English…
-
2
votes1
answer695
viewsWebcontrol input text mask
I created a Usercontrol called Ucldatavigencia very simple. Only one label and two Texts input that will be responsible for receiving a start date and an end date. I would like to apply a mask to…
-
2
votes1
answer103
viewsCenter a label on a badge
I’m not able to center a label inside a badge. It seems that the label is outside the badge. See the code: <Grid xmlns="http://xamarin.com/schemas/2014/forms"…
-
2
votes2
answers3799
viewsLoad a Dropdownlist based on an Enum - Asp.net core
I have a Personal E-nature that relates to the Person table. I need to create a dropdownlist in my view that displays the list of Personsnaturezas (PESSOA FÍSICA E PESSOA JURÍDICA), including…
-
2
votes2
answers460
viewsMethod to automate the call of Forms in C#
Here’s what I’m trying to do I am creating an application in C#, Mainframe is MDI Father, and I have other windows too. What I want is to use a class called "Formcaller" to call other Forms…
-
2
votes1
answer41
viewsMake the console take a value from another class in C#
I’m trying to learn C-language. In this case I’m trying to get the Console to show the balance value by taking this value from a different class in the same file (I’ve tried it with multiple-files…
c#asked 6 years, 7 months ago Douglas Marques 61 -
2
votes2
answers760
viewsInstantiate class with Static method
namespace Classes { class Program { static void Main(string[] args) { Editora ed = new Editora(); Program p = new Program(); ed = p.EntradaDeDados(); ed.InserirProvedorSql(ed); } public Editora…