Most voted ".net" questions
The Microsoft . NET is a set of libraries and functions that are part of the Basic Class Library (BCL), such as user interface functions, data access, connectivity, cryptography, web development, mathematical algorithms, and network communication.
Learn more…2,689 questions
Sort by count of
-
1
votes1
answer185
viewsWhy does this @Html.Dropdownlistfor not accept htmlAttributes?
I have a read-only view in some cases. I don’t want to use javascript as it can be disabled on the user side. At last... When I do this (for testing) it works perfectly. <div…
-
1
votes1
answer160
viewsGeneric CRUD in Entity Framework with unspecified entity
I’m trying to make a generic CRUD for my project. However as I used Databasefirst I do not see how to have a generic class of Entity that can be inherited. Because it doesn’t make any sense,…
-
1
votes1
answer341
viewsAspnet.Identity Creating user with Role
It’s the first time I’m working with Entity and Identity and I’m confused about how to persist my user. Basically I have a table User, with several relationships with the bank and Id int) I have the…
-
1
votes1
answer130
viewsHow to get value from a field in SQL using C#?
The idea is that I insert data referring to the same person within SQL, but in different Entities, contextualizing: I have the table Pessoa: create table Pessoa( ID_Pessoa int primary key identity…
-
1
votes0
answers153
viewsEntity Linq consultation in many-to-many relationship
I inherited a bank that is untouchable... despite having some very "strange" things. For example I have the following situation that would represent an n-n relationship but the relationship does not…
-
1
votes1
answer784
viewsProblems referencing a classlibrary from . net framework core - C#
I need to reference a class library . NET Core in my WPF layer which is a . NET Framework layer. However, a compilation error is made saying that it is not possible to refer to it. The error message…
-
1
votes1
answer2211
viewsDifference between @Html.Labelfor and @Html.Displaynamefor
I am starting at ASP.NET MVC and taking a course where the teacher used to display the data of a different class methods to display a given. He uses the @Html.LabelFor and the @Html.DisplayNameFor.…
-
1
votes1
answer48
viewsCan I run a . NET Native image directly?
I built my executable in C# for an image. NET Native using ngen.exe, I have the file location, but when I run Windows says the executable is invalid. My goal was to make my application written in C#…
-
1
votes1
answer233
viewsIs there any way to compare all received parameters?
I have the following method public Boolean Teste(String nome, String telefone, String...) { if(!string.IsNullOrWhiteSpace(nome) || !string.IsNullOrWhiteSpace(telefone)...) {} } There is how to…
-
1
votes1
answer104
viewsDataconnectiondialog giving error in Visual Studio 2017
I’m migrating to the Visual Studio 2017 a legacy project that uses a modal window to collect database connection data and format a string connecting. The code below shows an error: var dialog = new…
-
1
votes1
answer108
viewsLib dependencies in C#?
I’m making a C# lib to use in my projects and not always have to rewrite. but as I do with Lib dependencies? Example: I made a lib to use Google Drive and has the name lib.GoogleDrive but you need…
-
1
votes3
answers100
viewsConvert decimal to ushort
I need to convert a value decimal for ushort in my application: Is there such a possibility? If yes, how to convert? I tried to use the Convert.ToInt16(value), but it didn’t work. Console example:…
-
1
votes1
answer61
viewsShow photo of a listbox item gives me error Out Of Memory
I’m making a tool that turns a photo made upload by the user in bytes array then compare these Bites with the existing photos in the database I was able to make the code work but when at the end it…
-
1
votes1
answer45
viewsDeserialize for an Icollection without the need to create an extra class
Hello. I am using Json.NET to deserialize my object. Today I do it as follows: JsonConvert.DeserializeObject<ICollection<TModelo>>(stream.ReadToEnd()); Currently I have to create an…
-
1
votes2
answers97
viewsHow to assign a class to the whole and not just attributes separately?
I have a class constructor method that when called makes a query in another database class that returns me the same constructor method class(only with the assigned data), example: public Invoice(int…
-
1
votes1
answer75
viewsPython language format function in C#
int varvalor; int var01 = varvalor * 1; Console.Write("Digite um número para ser multiplicado: "); var01 = Convert.ToInt32 (Console.ReadLine()); Console.WriteLine(); I wanted to write on…
-
1
votes1
answer395
viewsWhat is the difference between Table and Matrix and List in Report View?
So far in my reports I have been using tables and I link my datasets to those. But today I needed to use a List to create a card (I’m still trying to understand how it works). When to use Table,…
-
1
votes1
answer279
viewsHow to pass and traverse an anonymous object in a method
How can I pass an anonymous object to a method, and then traverse it? What I’m trying to do is this: public static string QueryStringToUrl(string url, Dictionary<string, string> query) { var…
-
1
votes1
answer141
viewsCS1501 C# No Overload for method takes 2 Arguments
I’m starting to venture into C#, but I’m getting the bug "CS1501 C# No Overload for method takes 2 Arguments" The code is very simple and probably contains no error, because I am using the code made…
-
1
votes1
answer301
viewsIs coding a URL important?
Most languages have methods to encode and decode a URL, as in the case of C# System.Net.WebUtility.UrlEncode(string value) and System.Net.WebUtility.UrlDecode(string encodedValue). I realized that…
-
1
votes1
answer56
viewsCritical for when to deploy
In the case of a webforms . NET application that is being deployed, there is some way to warn the user that the system is being updated?
-
1
votes1
answer722
viewsIs it necessary to pay something to use Asp.net?
I heard that . Net is not free and I have to pay for Microsoft if I publish an application . net Is that true? If I want to install the technology on a web page server I have to pay something ?…
-
1
votes3
answers1421
viewsCompare if two date fields are equal in C#
I have a form and in that form I have two date fields, the campodata1 and completed by the user and the campodata2 and filled by the database, now I need a code to compare if these two fields are…
-
1
votes1
answer1690
viewsMysql net Connector and Entity Framework problem
When I install the mysql connector in version 6.9.11, I can see the driver for ADO.Net, so far so good. But when I try to create the template I get the following error: Now when I install the 6.10.6…
-
1
votes1
answer70
viewsShare on a web service with the client
I created a web service where there are numerators to keep track of an attribute of the whole type, I would like to know how to access this enumerator of another project in which I am using this web…
-
1
votes0
answers98
viewsreturn json c# . net core sql
I’m doing a test with a console application. In it I consult the database and would like to return a file json of the result. It is possible to return the query json without instantiating the…
-
1
votes0
answers133
viewsEntity Code First Migrations does not find Microsoft.EntityFrameworkCore.Design
Hello, I am working on a dotnet 4.5.1 project using Entityframework with Codefirst Migrations, I have added 1 new field to an entity and I am trying to add a new Migration, but the following error…
c# asp.net-mvc .net code-first entity-framework-coreasked 6 years, 8 months ago David oliveira barbosa 11 -
1
votes1
answer68
viewsKeep stack trace when the method gives rethrow in the captured Exception
I ran the Visual Studio Code Analysis application and in several methods received the following message: CA2200 Rethrow to preserve stack Details 'fooBLO.Foomethod(Dadosprojectdto, string)' rethrows…
-
1
votes2
answers952
viewsHow to center text in a Messagebox?
Right now I have this code: MessageBox.Show("Verificação da password incorreta \n Insira novamente"); And the output gets like this: Verificação da password incorreta Insira novamente How do I make…
-
1
votes1
answer79
viewsNhibernate consuming a lot of memory
I have an application that connects to the database via NHibernate, with this some operations are carried out as Save, Update e Delete. However, when performing these procedures, it is incredible…
-
1
votes2
answers192
viewsCompile a. NET application into a self-contained executable
I wondered if it is possible to compile an application . NET Framework in just one executable file. No files .dll outsiders. I did some research but was unsuccessful.
-
1
votes1
answer65
viewsHow do I treat message with special characters
I am consuming a REST service that is returning the following message with special characters: "Espã Título Inválida" It is possible to treat this message?…
-
1
votes1
answer62
viewsCreate Actions list with parameters and then run it
I would like to create a list of Actions with parameters and then do a foreach in this list and exit executing the methods, each with their respective parameters. Something more or less with the…
-
1
votes1
answer42
viewsRecording value of a variable in a table
I’m trying to save the data of 2 variables in a table, but when I look at the table in the database is recorded the values as 0. public void inserir(List<Conta>list) { List<Conta> lista…
-
1
votes1
answer74
views -
1
votes1
answer50
viewsDisplay form according to user response
I need a little help. I have a Grid, with a column named status de interesse, the type of that column is ComboBox. However, when the user selects the declined option I want to display a form x. How…
-
1
votes1
answer799
viewsSend view to controller values by jquery
I am making an application in . Net C#, and wanted to do an input and a button that sends the information to my controller for jquery/ajax, and I have no idea how to accomplish this, I need to pass…
-
1
votes1
answer61
viewsTwo actions for the same View
I have these two action: public ActionResult Lista(int PessoaId, string Nome, string Twitter) { Pessoa p = new Pessoa(); p.PessoaId = PessoaId; p.Nome = Nome; p.Twitter = Twitter; return View(p); }…
-
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
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
votes1
answer60
viewsCompress a file saved in Database
good afternoon! I have a file that is saved in bank, and I need to zip this file, when you download it. How do I do it? Thank you very much for your support
-
1
votes0
answers66
viewsExcel with password for editing
I am mounting an Excel file where I Gero an array of bytes and the UI downloads the file in xlsx format, I need to open this file with password to perform edits, there is a way to do this right in…
-
1
votes1
answer353
viewsSave JSON file information to database
I think about the possibility of a Web system saving information from a register in a JSON file on the client’s device, which would later be sent to the BD. This will happen when the client is in an…
-
1
votes1
answer52
viewsWeb Extension in Visual Studio 2012
I installed Visual Studio 2012 Express on my machine and did not add the extensions needed to work on the Web. In Visual Studio there is the option to add extensions and updates. There I located…
-
1
votes1
answer88
viewsIs it possible to create a column in LINQ?
I am trying to turn the following query into LINQ SELECT [nu_ano] ,[nu_mes] ,[id_projeto] ,[id_fase] ,'Financial Progress ("Competência")' as ds_categoria ,'Baseline' as ds_curva FROM…
-
1
votes2
answers88
viewsRename error message
Follows model: [DisplayName("Data:")] [ValueParser("ptdateparser")] [AssertThat("DeadLine > Today()", ErrorMessage = "* Data deverá ser superior a data de hoje")]…
-
1
votes1
answer66
viewsHow to set acceptable single values for an Enum property in a Serializable class?
Given a enum as an example: public enum IcmsCst { [XmlEnum("00")] Cst00, [XmlEnum("10")] Cst10, [XmlEnum("20")] Cst20, ... } There is a form of annotation so that I could specify that a certain type…
-
1
votes1
answer430
viewsType conversion error when saving to database
My project has a form frmAdicionarProduto to add products to the database containing TextBox and ComboBox: txtProduto txtQuantidade cmbTipo txtValorFornecedor txtValorFinal txtLucro I’m having…
-
1
votes0
answers145
viewsHow to hide Properties in Datagridview
How can I hide my properties from my base class. I want to hide the properties in the act of loading the Datagridview from the class person, perhaps with a syntax similar to [DisplayName("Titulo")]…
-
1
votes0
answers17
viewsSwagger 3.x works with . Net 4.7?
I am trying to create examples of Response and Input by Swagger but I am not succeeding. So far, the most I could was creating the MOCK request entry, the output ones I’m not getting. Follows code:…