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
-
3
votes1
answer84
viewsWhat is the fastest way to build text?
I have a large text (1000 lines) with formatting. Briefly (not this text but I will use an example) I have 2 ways to build it: StringBuilder sb = new StringBuilder(); sb.append("oi" + "meu nome" +…
-
3
votes1
answer101
viewsIs ASMX web service obsolete?
I came across the need to consume an ASMX Web Service. Until then I had only consumed Restful Apis. I noticed that the same is very different from a Restful API, for example. Given the way it is…
-
3
votes2
answers1011
viewsReturn with 2 C#Values
I want to give return of two values in c#. My code is like this currently, just returning the imagePath, but I want to return the imagePath and the normalPath at the same time. string imagePath =…
-
3
votes3
answers608
viewsRead a console line in C#
CS1503 Argument 1: cannot convert from "group of methods" to "Object" using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace…
-
3
votes1
answer568
viewsAccess a C# thread-based method object with Winforms
I created a thread to run a process that takes too long and makes the application process stop for a great while private void ExeConsultaClientes() { thread = new Thread(new…
-
3
votes2
answers74
viewsHow do I stop "for" when I find an item in the list?
I have the following code: Console.Clear(); Console.Write("Nome da moto:"); string nomem = Console.ReadLine(); for (int i = 0; i < ListadeVeiculos.Count; i++) { if (nomem ==…
-
3
votes3
answers72
viewsFilter specific file to not delete
How to make the code not delete a specific file I want between the .exe which I picked up. Example: I want it not to delete "test.exe", but still to continue erasing all the rest. Follows the code:…
-
3
votes2
answers106
viewsHow to implement an interface to secure a specific contract?
Need to get an interface to implement a list of a certain type: public class ITrade<T> { public int date { get; set; } public double price { get; set; } public double amount { get; set; }…
-
3
votes2
answers1248
viewsC# XML digital signature, poorly formed Reference element
I have a code c# that generates a xml with digital signature, but when calling the function signedXml.ComputeSignature() it shows the following error: Badly formed Reference element. However, I…
-
3
votes1
answer65
viewsDoubt in a lambda expression returning "true"
When I do that: List<Tipo1> tipo = await context.MeuMetodo.Find(x => true).ToListAsync(); What am I saying here: (x => true)?
-
3
votes2
answers499
viewsDefine a generic variable without defining the type
I’m doing some tests on Unity so I can practice programming. I’m new and this question can be kind of stupid. I want to know if this is possible: I created the following abstract class: public…
-
3
votes1
answer196
viewsHow to configure IIS for its proper functioning?
When I run my API by Visual Studio CTRL+F5 or F5 and open my application that consumes this API it works perfectly (Both on the same network or through NAT port forwarding). However when I publish,…
-
3
votes1
answer80
viewsIs it possible to include the necessary . NET to run a standalone application?
The title may be confusing, but the goal is to make an application written with . NET run without the . NET Framework. In practice this is almost impossible because the application depends on the .…
-
3
votes1
answer431
views -
3
votes1
answer291
viewsWhat’s the Context class for?
I am developing a system in ASP.NET MVC with mapping using the Entity Framework, when observing some patterns I see a lot the use of the class Context, what it’s for and what it should contain…
-
3
votes2
answers84
viewsUsing interfaces for domain classes
Is it good practice to make use of domain class interfaces? Do I have an advantage in doing so? If so, which one? Example: public interface IAuditoria { long AuditoriaID { get; set; } string…
-
3
votes3
answers297
viewsWhat is Appsettings for?
I was looking at Web.confg and would like to know what the <appSettings>? What it interferes with our application?
-
3
votes1
answer109
viewsIs it feasible to migrate from long to Guid?
Using Webapi, . NET Standard, C#, Entity Framework - Codefirst The records in long may exceed their limits. It is feasible to change long for Guid the primary key with the populated bank and running…
-
3
votes1
answer464
viewsHow to Replace Bar and Space by Dot and Comma in C#
I want to create a system that removes all bars and spaces per point and comma, for example 4587 / 5458 = 4587;5458 4587 5458 = 4587;5458 How can I create this system with C#? My code so far is like…
-
3
votes1
answer184
viewsWhat is the difference between arrays vs. Collections in C#?
Concerning arrays and Collections in C#, vary from application to application or there is unanimity between them?
-
3
votes1
answer137
viewsEntity Framework returns any type of data with Sqlquery
I’m trying to return dynamic values of a query also dynamic, but I can’t figure out how to get any kind of data from the database. Here’s what I’m trying to do comandoSql = @" SELECT " + NomeCampo +…
-
3
votes0
answers45
viewsBehavior of Math.Round
I have a project in VB.Net that I use the Round Function, but see the strange behavior: System.Console.WriteLine(math.round(32.625,2)) '32.62 System.Console.WriteLine(math.round(32.635,2)) '32.64…
-
3
votes1
answer123
viewsManage Datatable with lots of information
I have here a "small" problem with a DataTable. From an SQL query I am getting a huge amount of records (> 1,000,000), and although the consultation is relatively quick, the loading of the…
-
3
votes4
answers4102
viewsHow to return the values of a List<> in C#
I have a class Funcionario which has as attributes: CPF, Nome and Salario. I have to create an X amount of instances of this class in a List<> and after that, return to the user the values of…
-
3
votes1
answer326
viewsHow to open an executable that requires elevation via C#?
The code provided below seeks to be able to open an executable file so that it is possible to pass arguments to it once it has been opened. For the code as it is displayed, error returned is:…
-
3
votes1
answer279
viewsCannot use tskill in C#
The tskill command when used via C# (Visual Studio) returns this error: 'tskill' not recognized as an internal or external command, a operable program or a batch file However the same command when…
-
3
votes1
answer79
viewsWhat are Widening and Narrowing conversions?
I’ve heard that term in type conversions on . NET, but I don’t know if that applies to other platforms and/or languages. I have no idea what these terms are, so what is a conversion Narrowing and a…
.net terminology characteristic-language type-conversionasked 5 years, 2 months ago CypherPotato 9,292 -
3
votes2
answers590
viewsHow do I receive a value for each double variable on the console?
I was making a very simple code and I didn’t want to type a number and then enter it and then enter another number in another line, I wanted to know if I can do it in the same.…
-
3
votes1
answer89
viewsConvert all strings to lowercase
There is a way to configure the modelBuider, to lower my strings? For example, when I want all my data of type string, be at my bank a varchar, i make the following configuration:…
-
3
votes1
answer203
views -
3
votes1
answer4757
viewsCompare two lists of objects and pick only the different ones
I’m having trouble comparing two lists of the same kind List<Produto> in my product class I have the following structure. public class Product { public int IdProduct { get; set; } public…
-
3
votes1
answer269
viewsWhat kind of . NET library should I choose in C#project?
I’m thinking of creating a new project in c# I saw three types of libraries that caught my attention and I couldn’t distinguish exactly what would be the best applicability in each project. .NET…
-
3
votes1
answer384
viewsAsparallel(). Forall vs async await
When to use AsParallel().ForAll, and when to use async await? I am providing an example with a download and file manipulation routine. The AsParallel().ForAll has better performance in the download…
-
3
votes3
answers272
viewsDeserialization of JSON
I’m having a hard time deserializing this JSON: string json = "{\"Cidade\":[\"Arrio do Sal\",\"Atl\\u00e2ntida\",\"Bom…
-
3
votes1
answer77
viewsWhat is the scope of variables on an ASP.NET MVC page?
I have a view layout: <div> <h1>Pagina Principal<h1> </div> <div> <h3>Simular<h3> </div> <div class="row">…
-
3
votes1
answer40
views -
3
votes3
answers1393
viewsWhat do I need to know to work with C#backend?
What are the main technologies, tools, finally, what is needed to work with backend using C#?
-
3
votes2
answers293
viewsHow to make a switch in C#?
I see a lot of people saying it’s wrong to do switch in the code, because it ends up weighing and is ugly. Is it correct the way I am using and what would be an alternative to using it? Fill the…
-
3
votes2
answers154
views -
3
votes1
answer108
viewsError when calculating decimal value
I need to calculate the interest value, this is the code: public async Task<decimal> CalculatesInterestAsync(decimal valorInicial, int meses, decimal juros) { var valorFinal =…
-
3
votes0
answers190
viewsWhat is the difference between the terms X.509 and PKCS#7 in digital certificates?
Via a Webapi . Net 4.6.1 I am integrating with a service that requires data to be sent on a connection TLS 1.2 duly digitally signed using the standard PKCS#7, but when checking an example of…
-
3
votes0
answers520
viewsDownload file with Selenium Chromedriver in headless mode
I am trying to download a file in headless mode. I installed the driver like this: public static IWebDriver CriarWebDriver() { var options = new ChromeOptions();…
-
3
votes1
answer66
viewsHttpclient reuse and an Apicontroller lifecycle
Based on that website and also in some answers from Stackoverflow [en] I came to the conclusion that I shouldn’t use the class HttpClient in a block using despite the same implement IDisposable.…
-
3
votes1
answer74
viewsWhy char. Parse(string) returns a number?
I am making a program that uses Typecast, but when I converted a string to char (char.Parse()), received the following return: 115's' What is the reason for the conversion of string to char return a…
-
3
votes1
answer521
viewseSocialBX: Invalid signature error
I am trying to consume the Event Identifiers Query Webservice. But I get this return from the Recipe: <eSocial…
-
3
votes1
answer75
viewsWrong Linq expression when avoiding repetitions on a List
I’m trying to avoid duplicate data before giving a set value. I have a class Player that has itself a property called NickName, this class is inserted in List. Player class: public class Player {…
-
3
votes1
answer135
viewsHow to go through an array at each click on C#?
I’m trying to make a Image Viewer for multi page Tiffs. I’m wearing a PictureBox and two buttons - one to move down and to the next page, and one to move up and to the previous page. My code goes…
-
3
votes1
answer40
viewsStringbuilder append() converts to string automatically
Why when I use .AppendLine() it is necessary to convert the parameter to string, but when use .Append() conversion is not necessary?
-
3
votes1
answer302
viewsC# and Entity Framework with Foreignkey between classes
People in my projects .Net MVC use the structure below. My projects, are with Entity Framework. The briefcase Entidades, are the classes I use in DbContext. Detailing the problem I have the class…
-
3
votes1
answer285
viewsOpacity of images C#
Good morning, I came across a problem in my application Windows Form C#, I’m trying to apply an image with low opacity() background to my panel1, but the image when inserted gets 100% opacity,…