Most voted "c#" questions
This tag should be used when the question refers to some resource, information or problem related to the C#language. C# ("C Sharp") is a multi-paradigm programming language that has strongly typed variables, is imperative, declarative, functional, generic, object-oriented and component-oriented, which are designed to be executed in . NET Framework.
Learn more…13,899 questions
Sort by count of
-
2
votes1
answer38
viewsHelp with Join in lambda query
I have the classes: profissional { int id; int idUnidade; string nome; } unidade { int id; string nome; } profissionalUnidade { string profissionalNome; string unidadeNome; } I’m making an…
-
2
votes1
answer416
viewsI can’t find the reason for Formatexcpetion
Folks good night I have a little problem in a basic test program I’m doing someone could help me ? Error: The input string was not in an incorrect format. (Formatexception) in…
-
2
votes1
answer71
viewsAutomatic Cache Time Expiring
I am using the function below to store the cache was working normal, but now when add the time of 60min is as if it expires auto, now if I insert a longer time as 181min the cache is maintained. If…
-
2
votes2
answers2833
viewsHow to upload . txt file and save to a directory using c# net mvc?
I would like to upload text files where I select N files. txt and saved in a directory I specified in the application; I made an example that was on the internet but could not get the files in my…
-
2
votes1
answer31
viewsHow to create a Merged "Resourcedictionaries"
I have a small example where I created an application-level Resource: <Application x:Class="teste1.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"…
-
2
votes3
answers620
viewsCheck when global variable changes
I have the following problem, I have a global variable public static bool HouveAlteracaoBD { get; set; } and I need to monitor it when there is any change in its value, because I intend to follow…
-
2
votes2
answers1197
viewsCollision and Unity 3d reaction
I have a doubt in a script, I am creating a game made in Unity 3d. The doubt and the following, as I do to identify the collision between 2 objects and add a jump action to one of these objects, if…
-
2
votes1
answer344
viewsHow to change the source of an image control from a Resourcedictionary
I have the next Resourcedictionary: <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"…
-
2
votes1
answer231
viewsHow to change the size of a screen through an event in C# WPF
How is it possible to make a change in the size of a Form(Window) in WPF, by changing its Heigth and Width and thus increasing and decreasing the screen according to the reported values? For…
-
2
votes1
answer517
viewsSocket with C# and java
Good morning, I am writing an application where the server socket is in C#(due there are some drivers have to be in c#) and the client in Java. I can make the communication perfectly between them,…
-
2
votes1
answer47
viewsWindows service, using async method, is there a need?
In my system, I have some auxiliary routines, which are fired at defined times, outside of work hours. These routines are run by a Windows service program. Would you need to run these asynchronous…
-
2
votes2
answers308
viewsASP.Net - Make Page.Uiculture return culture in "en-BR" format
Was defined in the Web.config globalization: <globalization requestEncoding="utf-8" responseEncoding="utf-8" culture="pt-BR" uiCulture="pt-BR"/> However, when I read the Page.UICulture get…
-
2
votes1
answer643
viewsFormat Textbox for thousands?
I’m trying to create a Textbox to report values in thousands, the values will be for weights(kilos). I want to type the values from right to left based on the mask 0,000 and as the user type the…
-
2
votes1
answer1158
viewsSpecify command for the CMD to open
I am making a simple program with Visual Studio to run some commands on CMD that I want, currently the program has only a simple screen and a button to open cmd, but I would like to specify the…
-
2
votes0
answers160
viewsDirectory permission for the entire domain
I am trying to create a folder and assign it read permissions: public static void createFolder(string path) { DirectorySecurity securityRules = new DirectorySecurity();…
-
2
votes1
answer380
viewsRoutine included in Threadpool to run in "background" does not let the application continue running
I have the following code snippet in a method from my ASP.NET MVC application that deals with deleting directories and their files. // efetuo processos de remoção de arquivos do banco de dados await…
-
2
votes1
answer121
viewsInvoke selected Checkbox values in View Edit
I don’t know how to return the values selected in checkbox to the View. Controller: public ActionResult Editar(int? id) { // acedendo a um conjunto de valores de uma classe ViewBag.Daylist =…
-
2
votes2
answers998
viewsSearch week number of the year through a date in C#
I’m writing a function that gets a string with a date (format dd/mm/aaaa) and it must return a date (in the same format) 4 weeks later. Example: Entrada: 07/04/2016 saída: 05/05/2016 I read about it…
-
2
votes2
answers7804
viewsConvert a dd/MM/yyy string to Datetime
I have a date filter that should receive the information from a textbox and convert it to Datetime, so I can then compare it to another date. The textbox sends the date in the dd/MM/yyyy format, but…
-
2
votes1
answer1277
viewsHow to do Union all in LINQ?
I need to execute the command below using Linq: SELECT cnes, cmp, cbo, profNome, pa, sum(quant) total FROM bpai group by pa union all select cnes, cmp, cbo, profissional, pa, sum(quant) total from…
-
2
votes2
answers3157
viewsStart Windows Forms program in the background
I developed a monitoring application using Windows Forms, but it has no need to have anything visual at the moment, so I would like when running it, it to be executed in the background (I would like…
-
2
votes1
answer838
viewsWindowsforms - C# - Reportviewer - Composite object
Good afternoon, I’m starting to develop reports using Reportviewer for Desktop applications using Windowsforms (C#). I’m having problems with objects composed by others, for example: class Produto {…
-
2
votes1
answer1203
viewsError opening application with process.start
I have an app that when trying to run with the process.start or even direct by cmd from Windows, does not start properly (the application itself shows error), but if I go in its folder and open the…
-
2
votes1
answer37
viewsC# helps error with sqlite
Where is the error ? does not update at all SQLiteConnection conn = new SQLiteConnection(conexao); if (conn.State == ConnectionState.Closed) conn.Open(); SQLiteCommand cmd = new…
-
2
votes2
answers1443
viewsORA-22922: nonexistent LOB value in SELECT
I am facing a problem with two different consultations on oracle. Both have the sql snippet REPLACE(dbms_lob.substr(wm_concat(disctinct <COLUNA>)), ',', ', ') The error that returns is the…
-
2
votes2
answers2426
viewsDisplaynamefor and Displayfor
Studying about ASP.NET MVC, I came across the following lines of code: @Html.DisplayNameFor(model => model.Title) @Html.DisplayFor(model => model.Title) I can’t understand the difference…
-
2
votes1
answer62
viewsHow to work with Parallel using the Ninject library
How can you configure ninject to provide an instance of a given object for each thread that calls it? The ninject kernel can be run before a code with parallelism or it is necessary to instantiate a…
-
2
votes1
answer183
viewsLINQ to SQL with entities that already exist, inheritance and composition
I’m starting to study LINQ to try to implement a project I’m working on. For examples both in articles as in videos, LINQ has an interface in visual Studio that generates the entity classes from the…
c# inheritance abstract-classes linq-to-sql compositionasked 8 years, 5 months ago Matheus Saraiva 2,157 -
2
votes1
answer375
viewsDoubt with Array in C# returning data in Json
I have a structure that returns me the results of the header and detail, only that the records duplicates according to the details, as I could bring only 1 time the header, I appreciate the help.…
-
2
votes1
answer171
viewsHow to organize namespaces?
I heard that namespaces should be organized by layer, in case using some Pattern design which makes it possible, as Projeto.Controller, Projeto.UI, Projeto.Model, however, if we look at the…
-
2
votes1
answer246
viewsHow to list Mysql results in the listview
Structure of the Code In this function below I try to grab the contents of the Mysql database and passing to a List<BDependente> lDep on the line where this facade.listDependente(bDep);…
-
2
votes1
answer734
viewsHow to represent the Real type in C#?
I have an existing table in a bank of a client of mine and there has an attribute with the data type REAL. Like I do at C#? float or decimal? Which is the best way?…
-
2
votes1
answer172
viewsHow to delete lines from a datagridview
I am developing a program in C# and would like to know how I can block/delete an sql line in datagridview. The line I wanted to delete/block is the last one selected in the print, I wanted to know…
-
2
votes2
answers356
viewsException with timestamp in the database
I want to enter the time and date separately in the database, which have the fields timestamp and data, respectively. And I have the following code to add the fields:…
-
2
votes1
answer59
viewsSave image and rename without SQL
I’m having trouble saving several images without using a database. I have saved text data in txt, but cannot save images. I have already read the images. public partial class Form1 : Form { public…
-
2
votes1
answer55
viewsA problem to solve with English expressions
I did this, to return a list. It turns out to be an error, saying that there is no way to transform an anonymous expression into the past type (object). public List<Liberacao> PegaLiberacao()…
-
2
votes1
answer137
viewsUser add date to List MVC 4
I am new to ASP.NET MVC 4 and C# and need help. I have created a Enrollment class (discipline) public class Enrollment { public virtual int EnrollmentId { get; set; } public virtual string Name {…
-
2
votes1
answer258
viewsId pass to new MVC 4 controller
Continuing the previous topic (User add date to List MVC 4) I have a new question. You can see in this topic the initial question and the answer that I was given, but I needed to answer it but I am…
-
2
votes4
answers1643
viewsVariable in message box c#
How to put a variable inside the message box? The code comes below I think is self-explanatory. using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using…
-
2
votes1
answer318
viewsHow to update a Treeview of C#directories
I have a Treeviewms component (the one with Multiple Selection) listing the system directories in a Form. I created an event on the Form that when F5 is pressed, this Treeview will update itself(if…
-
2
votes1
answer91
viewsIs it possible to edit an http Response?
Is it possible to edit an http Response before it is rendered by the browser? Something with this scheme: Receiving the answer -> Editing the answer -> Streaming the answer to the browser.…
c#asked 7 years, 1 month ago Wesley Nascimento 395 -
2
votes1
answer3354
viewsHow to validate a digitized line of billets in the format 00000.00000 00000.000000 00000.000000 0 00000000000000?
Good afternoon friends, by chance someone would have some procedure similar to that and that you could post here? It will be of great use for me and future readers of this post. I await return. This…
-
2
votes1
answer580
viewsDatetime attribute error in C# saving to Mysql
I am trying to enter in the Mysql database the date of birth of the user, in C# the attribute data_birth is of type DateTime and in Mysql the attribute data_nascimento is of type Date, to insert C#…
-
2
votes1
answer46
viewsUndefined object reference for an object instance (which is not null)
I am trying to show the amount of free space of a drive (the C:) but I get the error "Additional information: Undefined object reference for an instance of an object". When I use a MessageBox to…
-
2
votes1
answer236
viewsXamarin - Dependencyservice NULL
Dear friends, good morning! I started seeing a tutorial to develop a simple app in Xamarin with Sqlite, but I have a problem, with an object that calls Dependencyservice, they always come null, and…
-
2
votes1
answer836
viewsHow to start a textbox with a value of 0 (zero)?
I have a form created with Windows Forms, and in this form I have textbox who will receive numbers. How do I make this textbox, when initializing, is already filled with value 0, that is when I open…
-
2
votes1
answer902
viewsWindows user on IIS
I’m trying to log in to a base SQL Server 2008, with the windows user who is accessing my site published on IIS. I’ve already set up Web.Config for windows authentication, set up the application…
-
2
votes3
answers410
viewsCall a method automatically via a partial class on . NET
I created a partial class to the model users where I implemented some custom functions, such as a function that takes the assigned name and surname and generates a handle, see in the following…
-
2
votes1
answer2149
viewsC# - Access Denied Windows Files
Hello I am making a software capable of scanning certain Windows files, where in it I leave filtered certain types of extensions, however, by placing to scan the following access message denied in…
-
2
votes1
answer132
viewsWhy is it not recommended to use the C# project event with WPF and MVVM?
I am too young for WPF I am doing a project using MVVM and Entity Framework and it has been suggested not to have any event Click to a button in the code behind a window, for what reason? What is…