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
-
2
votes1
answer499
viewsHow to print a double with 4 houses after the dot in C#?
static void Main(string[] args) { double area, raio , pi; pi = 3.14159; raio = Convert.ToDouble(Console.ReadLine()); area = pi * Math.Pow(raio,2); Console.WriteLine("A={0}\n",area.ToString("N0")); }…
-
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
answer834
viewsAPI Web Post Returns Invalid Content Type
I am trying to send a POST request to a Web API. If I do it for Postman, it works: Now when I try to perform through the code, I get the following error: { "status": false, "message": "Content Type…
-
2
votes2
answers172
viewsDoes the garbage collector really exist? Why then is there a memory leak in runtimes that use it?
I’ve heard of memory leakage in Oracle.DataAccess.dll and in large applications developed for runtimes with garbage collector. If the garbage collector exists in those runtimes, why there is memory…
-
2
votes2
answers173
viewsHow to Consume Less Memory in C#Runtime?
What I’d like to know is what are the most efficient ways to consume less memory in Runtime. Use of variables "Static" ? Create object with instants or a static class? Use of the Dispose() to free…
-
2
votes1
answer189
viewsRuntime object example in C#
Reading an article appeared the following term Runtime Object or "runtime object". What would that object be? Would it be an instance of a class? Someone could pass some example? The part of the…
-
2
votes1
answer1598
viewsRemote server returned an error: (400) Incorrect Request
I created two methods, one for authentication via A1 and A3 type certificate and one for sending an xml, both of which request a client’s Rest api. In the authentication method, I send my…
-
2
votes1
answer30
viewsHow to invert Control.Controlcollection’s list of controls?
I am inserting in a Panel several Labels, as I am inserting, the first Label becomes last in Panel. But I wanted to reverse this process. I wanted the first Label that was inserted to be in the…
-
2
votes1
answer77
viewsIs it possible to insert parameters in Filters Attributes?
I use ASP.NET and to do the access control by level, I use a filter that checks the level of permission of the user and allows access to view. [HttpPost] [AutorizacaoFilterAttribute] //Esse filtro…
-
2
votes2
answers93
views -
2
votes3
answers120
viewsProperty defined in constructor only returns zero value
I created a Web API in C# that returns me a list of products in JSON. However, the property PrecoVenda is always returned with the value zero and I noticed that this occurs because in the class…
-
2
votes4
answers567
viewsHow to know if the first character of a string is capitalized?
I need to know if the first character of a string is capitalized and does not let the program follow. How to do? Console.Write("Digite o nome do " + i + "º rei: " ); kings[i] = Console.ReadLine();…
-
2
votes1
answer2142
viewsRead a value inside a complex JSON in C#
Good morning folks! I’m new to C# and I’m having a hard time picking up a value within a complex Json. This is Json: { "id": "58e50b82-50b1-4f29-a2e8-a9a544013255", "timestamp":…
-
2
votes1
answer321
views -
2
votes1
answer231
viewsProblem installing Docker image
I’m installing a container image: microsoft/windowsservercore I am using the following command to download and install the image: docker pull microsoft/windowsservercore But it does not finish the…
-
2
votes3
answers106
viewsHow to create unmanaged variables?
When a variable is created, a value in memory is allocated to it, which can be accessed by any system on the outside from the address of that memory. Creating a file to store the contents of a…
.net security-guard memory-management garbage-collectorasked 6 years, 3 months ago CypherPotato 9,292 -
2
votes1
answer406
views.NET Core + Visual Studio Code - Structure organization
I have here with me some questions about developing applications in . NET Core using Visual Studio Code: How a base project is created, such as a "Blank Solution", as in Visual Studio? How is the…
-
2
votes3
answers551
viewsConvert string to integer positions
Console.Write("Digite um numero de 4 digitos: "); string numero = Convert.ToString(Console.ReadLine()); int soma = 0; for(int i = 0; i < numero.Length; i++) { soma += Convert.ToInt32(numero[i]);…
-
2
votes3
answers196
viewsGrowth ranges of an array’s values
I’d like to know a way to determine growth intervals and decreasing of a vector in C#. Example: Array[0]=0; Array[1]=1; Array[2]=2; Array[3]=3; Array[4]=4; Array[5]=3; Array[6]=2; Array[7]=1;…
-
2
votes1
answer278
views.NET Core and Mono: application development for Linux
Currently I have needed to develop applications (desktop) for Linux, and one of the requirements is that it would have to be using C#. And researching/testing, I got two options: .NET Core or Mono.…
-
2
votes1
answer94
viewsWhat is Membership for?
I was analyzing Web.confg and a question arose, what is the usefulness of the tag membership? What is he?
-
2
votes2
answers271
viewsDapper requires writing SQL code, why?
I’m looking at the following link that uses Dapper: Getting Started With Postgresql Using Dapper In . NET Core and my question is, when I do Java I don’t need to write SQL code as this example here:…
-
2
votes0
answers27
viewsSpatial data
What are the . net classes for working with geographic data (latitude, longitude, etc)? During a search I found the namespace System.Spatial but I saw in a forum someone advising against its use for…
-
2
votes2
answers582
viewsIs it possible to run an . EXE application from a Windows Service?
This is an excerpt from the code: protected override void OnStart(string[] args) { Process.Start(@"C:\path\<file.exe>"); } protected override void OnStop() { } I wish I could run a . exe…
-
2
votes1
answer38
viewsBuilder is coming empty
I am making a program in Asp net web apllication, but when I try to communicate the controller with the service the constructor this null saind, the dependencies are already configured in the…
-
2
votes1
answer82
viewsWhat is the build flow of the . NET framework?
I’m starting my walk on .NET. I’m programming in ASP.net but I can’t understand how an Asp.net project turns into html + javascript. I suppose there’s a compilation process behind it. Apart from…
-
2
votes1
answer200
viewsHow to split the screen with 2 Open Forms within an MDI
Good morning to you all. I have a question about forms. In my application, I can open 2 forms with grids where they present factory information. Those Grids are updated every 30 seconds, and are…
-
2
votes1
answer199
viewsHow to get all 'Yamldotnet' values in 'File.yml'?
I’m working on a.yml file and I want to get all the values it contains in that file. I’m using the reference Yamldotnet.Serialization. What I want to do is take a certain value and display the…
-
2
votes2
answers165
viewsHow to take the first character of a String and make it uppercase by storing it in a variable?
String user,newUser,newPassword, password, resposta, user1,pass1; user = "admin"; password = "123"; Console.WriteLine("LOGIN\n"); body: Console.WriteLine("Ja possui…
-
2
votes3
answers257
viewsSecurity Exception on UOL Host
I developed an ASP.NET MVC application that runs perfectly on site. When climbing it to UOL Host, when accessing the page (www.manuelaibi.com.br) I have the error Security Exception... It is…
-
2
votes1
answer129
viewsInstantiating generic type of an Enum
I would like to instantiate a class from an Enum, for example: Instead of doing: var classeGenerica; if (viewModel.tipoCarro == 1) classeGenerica = new classeCarro(); else classeGenerica = new…
-
2
votes2
answers172
viewsInitialize variable in a "for"
I remember that in C language I didn’t need to initialize the variable (in case i) with a value, I tried to do the same on C# and got a build error. In C# I am required to set the value of the…
-
2
votes1
answer875
viewsHow to invert a positive number to negative and vice versa in C#?
How do I get the number typed by the user, whether positive or negative, reversed? using System; namespace POOTeste { class Program2 { static int Main(string[] args) { int numero;…
-
2
votes1
answer60
viewsError debugging by null on connection
I want to document a unit test but I’m getting error: System.Exception: 'Error closing database connection: Undefined object reference for an instance of an object.' My test case was so coded: using…
-
2
votes2
answers174
viewsFormatting values per Razor pages
I’m having problems formatting a variable through the Razor pages in C#. Let’s say that a variable called value receives the number 9.5723 (real nine and 57 cents), I need all decimals above 2 are…
-
2
votes1
answer272
viewsOn which layer should I create constants in my application with DDD concept?
I’m using the DDD concept (Layers: Presentation, Application, Domain, Data and Crosscutting) in my ASP.NET Core MVC application and I was wondering about the best place to create my constants. In my…
-
2
votes1
answer64
viewsWhen can I use . NET Framework 4.x and . NET Core on Windows, Linux and Macos?
Application using NET Framework 4.x can be run on Windows, Linux and macos? And application using . NET Core can run on Windows, Linux and macos?
-
2
votes0
answers51
viewsHow to successfully read and process data received through the Visual . NET serial port?
I got a arduino who is the detect tapping on a signal line audio level. Whenever it is detected a beat the arduino sends the character b to the serial port. So far I’ve managed to do. Now I was…
-
2
votes1
answer83
viewsJoin to Linq c#
I have the following query in Sql Sevrer SELECT PT.id, P.nome AS Codigo, PT.topologiaid, TE.id AS TipoEntidadeId FROM [dbo].[propriedade] P INNER JOIN [dbo].[propriedadetopologia] PT ON P.id =…
-
2
votes1
answer86
viewsWhat the hell is marshaling?
Whenever I see signatures of P/Invoke full of Marshaling attributes I always remove one by one and testing if this causes any error, most of the time I end up with a signature with no attribute, no…
-
2
votes2
answers386
viewseSocial: Invalid Subscription . NET Framework
Invalid Signature Good afternoon, I have a problem transmitting the information to the webservices of eSocial. The process I do is the following: the events Xmls are generated on the server,…
-
2
votes1
answer178
viewsIf in C# "Enum"s only accept whole types, why accept a "char"?
When we’re learning about enums in C# is said to accept only integer numeric types. Therefore, we soon think of sbyte, byte, short, ushort, int, uint, long or ulong. But the code below also works,…
-
2
votes2
answers211
views -
2
votes1
answer38
viewsWhy in a generic-type method extension do I not need to spell out a type when calling it?
In the link below is a code snippet consisting of nothing more than a Shuffle method that is used as a Extension Method of Array. Although the method is generic type, I don’t need to pass a guy when…
-
2
votes2
answers73
viewsUse standard Form instance in another class
This is my class HotKey public class HotKey { private string nome; public HotKey(string nome) { this.nome = nome; } private void Start_KeyPressed(object sender, KeyPressedEventArgs e) {…
-
2
votes2
answers395
viewsHow to assign a default date on a Datetime type object in C#?
I created a class called Order, and in it I created a field for the purpose of entering a date of delivery of the order. But I created the object on Main(), and at the time I execute it fills in…
-
2
votes2
answers55
viewsWhat is the Bufferedstream of C#?
I need to accumulate bytes in a buffer and then download them into a file. I used a few tricks for it but I was told there’s a little guy who can help me, BufferedStream. By instantiating it, I set…
-
2
votes1
answer54
viewsHow to lock a method so that others do not call while it is used?
I have a simple method of log, which adds some lines to a special file. The problem is, the application is multi-threading, and in each Thread is called this method to log, and when one is called,…
-
2
votes1
answer43
viewsC# How to pass service and model to a search window
Hello, I have the following situation. A CRUD form calling another form (common or generic) to search for records... private void barButtonItemProcurar_ItemClick(object sender,…
-
2
votes1
answer400
viewsGrab URL directly from an image of my ASP NET MVC application
Good afternoon, I’m trying to make an API to return the URL of an image list but I don’t know how to do it. I found things with server.mapPatch but these return the physical address of the file. I…