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
votes2
answers88
viewsAssign once control event to event method
I’m making a sequence of screens in the form, I have a main screen that loads other screens, the main screen is the Form1, and the subtleties will be the ones I will add on the main screen through…
-
3
votes1
answer82
viewsMake if in an HTML tag to add or not attribute "checked"
I’m developing with the .Net Core Razor and I’m setting a string in my GET and I need that, according to what this string (in the case of "true" or "false"), checkbox whether or not marked. To…
-
3
votes1
answer83
viewsCounting amount of results of a Split()
I have a string that looks like this: Yeah, No, Maybe And I have a code that I need to put these string results separately into a <option> of a <select>. I intend to do this through a…
-
3
votes1
answer454
viewsQuestions about Sendmessage and Postmessage
I began to study the methods of SendMessage and PostMessage of User32.dll and I came up with some questions. I will put down the code I tested and soon after the questions, if anyone can help me.…
-
3
votes1
answer291
viewsIgnore Automapper property
I’m using Automapper version 7. I need to ignore a property that is in the result class and has no source class. As below. public class Contrato { public string Id{get;set;} public string Nome…
-
3
votes1
answer549
viewsCS7036 error on C# calling a function
I just got into the matter of functions and methods and I’ve come across a problem that I can’t solve at all because I don’t understand why. The point is: "Create a method that takes an integer…
-
3
votes2
answers295
viewsProper use of while to validate data entry
I’m trying to apply a repetition using the while also using the IF condition, which returns a message to the user if they enter an invalid value. Note that I write nothing inside the while, but the…
-
3
votes1
answer167
viewsCapture and treatment of exceptions in a generic way
In general the most common is to capture the exceptions specific and do some treatment with it, right? Example: try { //Algum trecho de código } catch (MyException myException) { //Especifico para…
-
3
votes2
answers164
viewsUpcasting and subsequent downcasting allows you to access the attribute of the original type?
When I make a upcasting, object 1 will be converted to its supertype and an object 2 is created When object 1 is instantiated before doing the upcasting, has attributes that do not exist in the…
-
3
votes1
answer101
viewsImprove performance in iteration
I have a C# method that receives a List<string> and I must return a string with the list of members of the List<string> ordered by number of occurrences and then alphabetically. I did…
-
3
votes1
answer35
viewsHow to serialize Object for yaml in . NET?
We can serialize objects (I’ll use as an example C#) for XML, using the class System.Xml.Serialization.XmlSerializer, for example: var obj = new AlgumaClasse();…
-
3
votes1
answer48
viewsUnable to initialize a generic object with inheritance
I’m having a hard time accepting an inherited class as a generic class type. public class Teste { private void Testando() { var dog = new Cachorro(); dog.Nome = "Toy"; dog.Patas = 4;…
-
3
votes1
answer81
viewsIs it correct to use an object to call a method where it will be the parameter?
I am creating a small project in without Entity Framework and I have a question at the time of passing an object as parameter, it is correct to pass the same object that calls the method as…
-
2
votes2
answers3614
viewsHow do I convert the size of a file into bytes for KB, MB, GB, TB, etc?
I’m picking up the file size to display on the screen: new FileInfo(arquivo).Length Only this property returns me the total of bytes... I would like to display in a format that I could understand,…
-
2
votes1
answer954
viewsHow do I convert a Datatable to a dynamic object?
How can I convert a DataTable in a IEnumerable<dynamicObject>? For example, I want to convert any DataTable ID | Name DI | emaN --------- ou --------- 1 | x 2 | x 2 | y 1 | y In a list of…
-
2
votes1
answer1464
viewsSend CR LF via Serial port c#
I’m communicating by Serial (SerialPort) with a device that requires me to send commands CR LF at the end of each instruction for the device to understand that an instruction has been sent to it.…
-
2
votes1
answer268
viewsHow to hide images from 'Resources' folder?
How do I create a file to put the images in the 'Resources' folder? I don’t want the people who use my program to have access to them. The file can be any extension.
-
2
votes1
answer277
viewsError in runtime VB6
I have a DLL that was created in . NET and I need it to run as COM+. code in . NET: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace thiago.dll.NET {…
-
2
votes1
answer987
views -
2
votes2
answers256
viewsNumber of variable parameters in C#
I know you can do this. But I can’t find how. How do I make a function accept a variable number of parameters of the same type, similar as an array? So I can just call it that:…
-
2
votes1
answer116
viewsThrottling to a Method
I was experimenting with the concept of throttling and some doubts have arisen Part 1: How to translate this concept into a single word? Part 2: Is there a library that has a simple implementation…
-
2
votes2
answers328
viewsWhich framework should I use for Functional Testing on . net?
I would like to know the framework options that simulates testes unitários to the .net. I know a little Ruby and I know that there is Cucumber which by the way is very good, but to .net I did a…
-
2
votes2
answers167
viewsError in calculation of execution
I have the following question. I have these following times obtained through the Stopwatch, where it was placed within a method to return the employee’s hours bank balance. Only that he is showing…
-
2
votes2
answers612
views -
2
votes3
answers2384
viewsMedia Player Classic libraries in my Windows Form project
I am developing an application that will work as a player, however the videos inserted in my software will be of various different formats avi, mp4, flv and etc... for this reason I do not want to…
-
2
votes2
answers2118
viewsHow do I set a Radiobutton to default?
I have several radiobutton’s. How do I leave one marked as default? private void radioButton2_CheckedChanged(object sender, EventArgs e) { comboBox4.Visible = false; comboBox5.Visible = false;…
-
2
votes2
answers1042
viewsCollect information from system resources
I’m using S.O. windows, and C programming language#. How to collect system resource information in C#? processing, memory, disk. I’m running performance tests, with multiple clients and a server…
-
2
votes1
answer338
viewsGet value from XML
I’m having trouble getting the value true of this XML: <boolean xmlns="http://schemas.microsoft.com/2003/10/Serialization/">true</boolean> I tried this way but I couldn’t: var ns =…
-
2
votes4
answers6360
viewsBreak row into table cell in CSV format to be read by Excel
I have the following code that inserts a value in an excel cell for export context.Response.Write("aa\r\nbb\r\nccc"); /r/n breaks the line but writes in the cell below, would like to break the line…
-
2
votes3
answers240
viewsHow to display "from" inside the Datetimepicker
In the DateTimePicker I can display anything using d to day, MM or MMMM for month and yy or yyyy to year. However, I would simply like to display on the property customformat: April 15. But when I…
-
2
votes2
answers3231
viewsSome method to save data from an Arraylist
First of all, some information: = .NET Framework 4.0 = Visual C# I’m simulating a database using a class specifically for this, using a List<string[]>, however, I would like to be able to…
-
2
votes1
answer1238
viewsDoes C# support GPS?
It is possible via a computer I find the location of a cell phone with altitude, longitude and latitude using C#? Is there a library for that? Do I need any specific hardware to be able to put into…
-
2
votes4
answers1315
viewsHow to group code and add existing amounts in text files with C#?
I have several text files inside a directory. I need to do in C# and join all the text files in a final text file, but treating their contents. Example: Arq1.txt 123456010 654321020 Arq2.txt…
-
2
votes2
answers513
viewsHow to put between within a code query?
I have the following consultation and I would like to put in the clause Where the condition of being within a certain period. public static DataTable stCloseCaseAll(int schoolId, string dataInicial,…
-
2
votes1
answer1306
viewsChange Webservice address at runtime - C#
I am developing an application that should connect to several Web services according to the user’s location. For example: If the user is in the city "To" it will connect to the web service:…
-
2
votes1
answer46
viewsWhich reference to import into Tableattribute?
I’m not getting my application to find the table tag. using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Dominio { [Table("Loja_Carrossel")] public class…
-
2
votes1
answer376
views -
2
votes2
answers917
viewsAmount of a given character contained in a Stringbuilder
I have a Stringbuilder with these values: 12********3*4*. There is a simple way to return the amount of asterisks without having to do a go over my Stringbuilder? I’m using C# with Net Framework 3.5…
-
2
votes1
answer41
viewsMaintenance and recovery of service Urls
I am working on a Web Forms project that has a DLL, and in this DLL there are references to external services. We have 3 environments (development, homologation and production) and for each…
-
2
votes1
answer60
viewsProblem - Linq SQL Server: Unwanted query in database when assigning value in a database derived field
All right, guys I have the following problem: I have the method below that only has the job of updating a field in the database, the class t_sap_log_jobs that is passed as parameter was created…
-
2
votes1
answer360
viewsHow to observe user inactivity and enable or disable the lock screen on Windows Phone 8.1
How do I turn off automatic screen lock on windows phone 8.1 ? phoneService.UserIdleDetectionMode = IdleDetectionMode.Disabled; Before the use of the line above met, but the same is no longer valid…
-
2
votes1
answer111
viewsAppcache in Asp.net MVC
I need to use the Html5 appcache to store some web pages. Before using MVC I simply did this regular expression to check if you are connected or not. var offlinePages =…
-
2
votes1
answer789
viewsWhich aspect-oriented programming frameworks exist for . NET?
Researching about aspect-oriented programming, found a framework that implements this paradigm, the Postsharp. But this tool is paid for some Ports. Does anyone know any more?…
-
2
votes1
answer641
viewsConstructor class Abstract
I’m failing to develop the following environment: public abstract class AplicacaoGenerica<TEntity> where TEntity : class { private IRepositorio<TEntity> repositorio; public…
-
2
votes1
answer197
viewsUpdate Entity framework version
I just upgraded my version of . Net 3.5 to 4.5.1. My Entity Framework was in version 3.5, I wanted to know if it already updates to the newer version after the exchange of framework.…
-
2
votes1
answer1902
viewsIs it possible to get a specific line of txt/csv file using an address?
It is possible to access a line from a file txt/csv (example below) by your address directly without having to go through each line using C#?…
-
2
votes1
answer63
viewsGet an X-size from a Picturebox?
I have a Picture Box, and in some part of the code I edit the horizontal size (x) of it, then further down in the code, I need to edit only the vertical size (y). I want the size of (x) to remain…
-
2
votes2
answers608
viewsUse of the Ienumerable
I saw an example in another post about the use of IEnumerable var ent = new EntFuncionarios(); IEnumerable<Funcionario> funcionario = ent.Funcionarios; IEnumerable<Funcionario> temp =…
-
2
votes1
answer95
viewsReturns Excel in C# List is returning null
This code reads a file Excel and plays a list, the problem that is occurring is it is returning null, like there’s nothing in the Excel, but the column names are correct: string PathConn =…
-
2
votes1
answer327
viewsAccess URL without receiving the reply
I have a page that performs several tasks. This page is open to end users of the system, who can access it via browser. In certain situations I would like to trigger page processing with a console…