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
answer1235
viewsDestruction of an instance
How do I destroy an instance? I have an object whose instance is referenced in various parts of my code. At some point I need to delete this object and for that I am doing the following: meuObjeto =…
-
3
votes1
answer117
viewsAccessing data stored in cookies?
In login, I store user information logged in to a cookie (name, password, etc...) How do I access this cookie and redeem information from it? For example, I want the name of the logged in user to…
-
3
votes2
answers928
viewsHow to scan a string and check content within it?
I need to do a check with a certain text within a string. How do I go through this string and search the text to make this check ? Example: If(dentro da string contém "Olá") { Mostre o valor…
-
3
votes2
answers1067
viewsHow do I print to dot matrix printer on the client with a web application?
I have an application made in C# MVC with a routine to print a plain text on the standard printer. The method was used RawPrinterHelper.SendStringToPrinter that is described in this article.…
-
3
votes0
answers257
viewsNhibernate.Xmlserializers - Isn’t there?
Unable to load file or Assembly 'Nhibernate.Xmlserializers, Version=4.0.0.4000, Culture=neutral, Publickeytoken=aa95f207798dfdb4' or one of its dependencies. The system cannot find specified file.…
-
3
votes1
answer1326
viewsHow to locate an image without informing the absolute path?
How to locate an image without entering the absolute path? Image img = System.Drawing.Image.FromFile("~/Content/images/SemFoto.jpg"); I tried several ways and could not capture the image without…
-
3
votes1
answer1677
viewsError 242 while consuming Nfedownloadnf
I’m trying to consume the NFE download service on the farm: https://www.sefazvirtual.fazenda.gov.br/NfeDownloadNF/NfeDownloadNF.asmx but I have obtained the following error: ERROR: 242 Reason:…
-
3
votes2
answers108
viewsMemory Leak in Xmlserializer
I have the code below. How the method is static and the XmlSerializer does not implement the Dispose, at each call of the method, the system stacks in memory or the GC (Garbage Collector) can clear…
c# asp.net-mvc .net memory-management garbage-collectorasked 8 years, 12 months ago Tiedt Tech 2,427 -
3
votes1
answer1163
viewsCannot evaluate Expression because the Current thread is in a stack overflow state
You’re making that mistake: Cannot evaluate Expression because the Current thread is in a stack overflow state in the variable qtde adding it to the list desci. class descricaoo : IInstrucao {…
-
3
votes3
answers321
viewsPass List as LINQ expression parameter
I have a LINQ expression where the result is saved in the variable query, which is transformed into a list, this query returns a series of "RA attributes". I would like to pass this list of…
-
3
votes2
answers125
viewsImplementing relationship in C#
I have the following classes: The code is like this: public class Mae { public string Nome {get; set;} public List<Filho> Filhos {get; set;} } public class Filho { public string Nome {get;…
-
3
votes1
answer246
viewsCreate second column in Datatable
I have a DataTable where with the code: DT.Column.Add("1ª", gettype(int32)) For I = 1 To 30 DT.Rows.Add(I) Next(I) This For lists column 1 from 1 to 30. 'DT is declared with a new DataTable, in this…
-
3
votes1
answer72
viewsGet character index based on Width
I have the following method to calculate the width of a text: public float GetWidthOfString(string str, Font font, int bitmapWidth, int bitmapHeight) { Bitmap objBitmap = default(Bitmap); Graphics…
-
3
votes1
answer85
viewsClosing requests
I currently make several HTTP/HTTPS requests to different websites using the classes HttpWebRequest and HttpWebResponse using framework .NET 4.0*. We are facing a problem when there comes a time we…
-
3
votes2
answers253
viewsHow to work with a Datetime instance without the time information
My tests had been passing successfully, when "by magic" one of them started to fail: var data1 = DateTime.Now.AddDays(1); ...processos ...processos var data1 = DateTime.Now.AddDays(1);…
-
3
votes2
answers423
viewsHow to manipulate instance properties of a class that is in a List<T>?
I have a class called Pessoa, this class has two properties Nome and Idade, I am using a List<T> to manipulate data, I know I can manipulate data like string or int creating a…
-
3
votes1
answer108
viewsProperty of a class that belongs to another context in the Entity Framework
I have a class called Locker that has the following property : public virtual ICollection<LockerReserve> Reserves { get; set; } The problem is that Lockerreserve belongs to a different context…
-
3
votes3
answers2350
viewsAdd multiple items to a list
Is there any way to add several Intin a list<int>all at once? Type List<Int32> ContasNegativas = new List<Int32>(); ContasNegativas.AddRange(30301, 30302, 30303, 30304, 30305,…
-
3
votes1
answer155
viewsCreate dashboard with center at user click point
I need to create a Panel in a Form Getting kind of like this: When you click the mouse on Form create the Panel taking the location of the click and create the Panel centralized. I did so: Panel…
-
3
votes2
answers784
viewsVisual Studio 2015 Hangs and not back when accessing cshtml page and inserted "<"
Guys this very strange. In any project when I insert in a cshtml file a "<" visual studio 2015 crashes and restarts, this occurs in any WEB project, already reinstalled it 3 times and always…
-
3
votes1
answer2375
viewsDoubt - Visual Studio Export/Import Project
I’m having problems importing projects into VS 2015. The project was done in an earlier version of the IDE and when I import it it doesn’t come with the components correctly added, needing to add…
-
3
votes1
answer1051
viewsCreate fields dynamically and set in model
I am developing a register, where I have my fields according to my model: public class Autor { [Key] public int IdAutor { get; set; } public string Nome { get; set; } public DateTime DataNascimento…
-
3
votes2
answers955
viewsPass variable to another form, dynamically generated C#
I have a question regarding passing the value of a button to another form. I have the following code private void dataGridView1_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e) {…
-
3
votes3
answers533
viewsHow to point the Entity framework to another database?
Hello, My Entity Framework always points to my local database...I have tried to change the string Connection by passing the data of a database that is on another server and nothing happens it keeps…
-
3
votes1
answer186
viewsHtml.Beginform() No Submits model, Modelstate.Isvalid = False
Next I am with Html.Beginform() where the same Submits the model however when it goes to the control it is false the Modelstate.IsValid. Follows Model, Control and Beginform Model:…
-
3
votes2
answers1914
views -
3
votes1
answer363
viewsInsert current date in a field
I’m using dataAdapters do . Net to create a project as a BD learning base with C#. I chose an easier path that would be to work most of the time in design mode through the Datasets. The battle I…
-
3
votes2
answers16833
viewsHow to obtain only the date, without the time, of a Datetime?
Converting a field using ToDateTime it brings the date and time. parcelamento.data_vencimento = Convert.ToDateTime(reader["data_vencimento"]); Is there any direct conversion to bring only the date…
-
3
votes2
answers597
views -
3
votes3
answers847
viewsConversion of a variable with replace to decimal
I’m having a little doubt, I pass a value 0,05 decimal for a variable A of the kind string. After this variable receives this value, it does the conversion of , to point ., which remains 0.05 After…
-
3
votes2
answers102
viewsCan an Exception cause a Sqlconnection to close?
I’m building the treatment of a connection and I came up with this question in mind, yet I couldn’t find a satisfactory answer. So I came here to ask the most experienced programmers. Is there any…
-
3
votes2
answers981
viewsSerialization of a large list in JSON.Net
I’m having a problem to be able to serialize an object (a list of a class with approximately 5000 items). I am using JSON.NET to generate the Json string but it is getting the following problem, in…
-
3
votes2
answers1532
viewsCapture text between two known characters
I need to pick up any text and find the words (or phrases) that are between two specific characters { and }, in that case. I can do this by capturing the delimiters together, using the expression…
-
3
votes1
answer192
viewsVector start with element greater than 0 (zero)?
Usually a vetor starts from the element 0, and so on until you get to the size of which it was declared or assigned, example: string[] v = {1, 2 , 3}; // equivalente á: v[0] = 1; v[1] = 2; v[2] = 3;…
-
3
votes1
answer379
viewsPagination with generic method
I am trying to create a generic method for paging, I tried to do as the code below, but when using Skip I need to have a orderby and I’m not sure how to do. public IQueryable<TEntity>…
-
3
votes2
answers3501
views -
3
votes3
answers4226
viewsPersist information using Viewbag?
I have my screen login is to show the name is id of the logged in user on another screen, so I can use this information. In my controller: [HttpPost] public ActionResult Index(TB_USUARIO model) {…
-
3
votes4
answers3830
viewsCompare number within a numerical range
I want to create a function that receives a number and check if it is within a range from 1 to 25. What is the best way to do this? private int VerificaIntervalo(int numero) { if (numero > 25) {…
-
3
votes1
answer88
viewsNegative return from Array.Binarysearch()
I needed to make a comparison of the kind of methods normally created as inList or something like that. When searching the Microsoft documentation, I found the Array.BinarySearch(T[], T). I…
-
3
votes2
answers1359
viewsSpecified conversion is not valid in Executescalar
The specified conversion error is not valid happens in the code: if (command.ExecuteScalar() == DBNull.Value) { resultados[j2][i2] = 0; } else { resultados[j2][i2] =…
-
3
votes3
answers884
viewsList of Exceptions
How to implement a class so that I can add an Exception to an Exception list. This class would be used for the case below, for example: In the validation method can return one or more errors, so…
-
3
votes1
answer92
viewsChange of environment
I’m moving from environment, from VB.NET to Java (Netbeans), but I’m still not sure if some of the possibilities of . NET can be performed in Java with Netbeans. My first doubt materializes in the…
-
3
votes1
answer61
viewsGet values from Arraysegment
By creating a ArraySegment, would like to get the new array created, but when using: meuSegmento.Array; the array original is returned and not the created segment. string[] meuArray = {"stack",…
-
3
votes2
answers1790
viewsData Search with Entity Framework
I have a project in Asp.Net MVC where I need to work with a large volume of data. To get them from the Database (Microsoft SQL Server) using Entity Framework 4 I know basically three ways: first…
-
3
votes1
answer131
viewsHow to make a lambda pivot in a C#list
I’m having a hard time making a pivot command on a list that’s coming from the bank. Above the select that is coming with the data.. The data field q I would like to put the pivot command. Follow my…
-
3
votes1
answer690
viewsTemporarily store data in ASP.NET MVC
I need to store some strings temporarily in an ASP.NET MVC application, these strings need to be accessible by server-side application at any time and the application itself will be in charge of…
-
3
votes2
answers8240
viewsDouble quote character removal "
I have a code that reads a CSV and saves the information in the database, but I ended up getting a CSV "different" than what I’m used to reading. This CSV come with double quotes in the information.…
-
3
votes1
answer158
viewsStore List<Menu> In Memory or Cookie
good afternoon. I have an application that has a whole level of permissions management of access to pages and a number of other settings. Whenever a user authenticates, I assemble a list of all the…
-
3
votes1
answer1817
viewsMalformed Reference Element: Digital Signature
I ended up having the same problem about a post already made here, but they see a question next to what was posted in the article. Which windows update would be to remove among those cited in this…
-
3
votes2
answers488
viewsConvert string array to string in VB
I need to use SPLIT in multiple data, but I need to convert the string to string array for this. I’m putting String() to receive the string array variable, but VS keeps telling me that one dimension…