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
-
8
votes2
answers6054
viewsHow do I read the record of incoming and outgoing calls on my iPhone using Xamarin?
How do I read the history log of incoming and outgoing calls on iPhone using Xamarin? I need to read the log of the calls/ made on iPhone. I do not know how to do and I did not find any material in…
-
8
votes1
answer494
viewsRead contacts contacts agenda iPhone using Xamarin
How do I read the contact list in my iPhone phone book using Xamarin? I need to read the contact list of the iPhone agenda. I do not know how to do and I did not find any Portuguese material on the…
-
8
votes3
answers920
viewsCan using non-priminal variable type in C# affect performance?
Using non-priminal variable type in C# can affect performance? I have seen several codes where, instead of using primitive C#types, many use types similar to other languages that the IDE accepts. I…
-
8
votes6
answers1227
viewsProperty readonly . NET
I received this question in a test and could not answer: "How is it possible to declare a property readonly in . NET / C#?"
-
8
votes3
answers853
viewsHow to replace hexadecimal value in a binary file?
Can you tell me how to replace the Hex value of a file with C#? Example: replace 62 61 72 ("bar") for 66 6F 6F ("foo").
-
8
votes3
answers1601
viewsBreadcrumb algorithm in ASP.NET MVC
I’m writing a system on Asp.net-mvc And the idea is that there’s a Breadcrumb on every canvas. With no ideas for a good algorithm, I created a Helper that returns a list of objects according to the…
-
8
votes1
answer492
viewsHow to get the generic type entity type from the top interface?
I have the following situation: public class MinhaClasse : IMinhaClasse<Carro> { //... } public static void Main(string[] args) { var foo = new MinhaClasse(); } It is possible to get the…
-
8
votes1
answer862
viewsCapture buttons pressed on video game control reliably
I want to use an Xbox controller to control a program. It’s not a game, it’s just an app Windows Forms. I don’t want to use XNA because I don’t want to force the redistributables to download when…
-
8
votes3
answers637
viewsDeploying queues for Websocket
I’m developing a server WebSocket which will control multi client connections, will basically function as a chat, will be a kind of game multiplayer, after many researches and some tests I realized…
-
8
votes2
answers1261
viewsHow to get all records from a mixed table generated by class inheritance when using Entityframework 6?
I have a class structure in the following form: public class Pessoa { public int Id {get; set;} public string Nome {get; set;} } public class Membro : Pessoa { public int CargoId {get; set;} public…
-
8
votes2
answers2694
viewsConsuming C#(dll) functions in a C/C++ project
I need to call/reuse some functions I have in a DLL, developed in C#, within a project done in C. I already looked for some things and what I managed to make it work was this project:…
-
8
votes2
answers129
viewsGet user-created methods
I have a method that lists the methods that a given object has, I want to take only the methods created by the user, in this case: Add and Subtract. What this method returns to me: Generic Class…
-
8
votes1
answer1767
viewsHow to download automatically on a site that calls Javascript?
I need to make a program that downloads Pdfs from various websites daily and automatically. It is very easy to perform this operation using the C#Webclient command, however, on certain websites it…
-
8
votes1
answer9757
viewsHow to round up decimals to get an integer in C#?
I have the following account: var NumeroDePaginas = NumeroDeItens / 32; When I use the Math.Round It rounds both up and down. But whenever there is any decimal value I wish to return an integer…
-
8
votes2
answers1879
viewsWhat are the differences between background and foreground threads?
What are the differences between these two types of threads: background and foreground?
-
8
votes2
answers925
viewsHow to add Static methods in interface?
I have my method: public static CloudStorageAccount GetAccount() And in my Interface: public interface IAzureStorangeService { CloudStorageAccount GetAccount() } But the compiler accuses that the…
-
8
votes2
answers732
viewsHow to structure a solution by separating Webapi from Webui using ASP.NET Identity?
How should be organized a solution that will have at least three projects, being them: Class Library as infrastructure Web Application as Web Api Web Application MVC for Webui (user interface) Where…
-
8
votes1
answer1158
viewsRecommended form for popular variables with database data
Assuming this fictitious method to obtain database data, say SQL Server: public List<DadosDTO> ObterDados() { try { comand = connectionFactory.CreateCommand(); comand.CommandText = "SELECT…
-
8
votes2
answers3396
viewsWhat is the use of methods with an "inter-ternal" modifier?
In what situation I would use a modifier method internal? There is a specific reason for this, namely where a public or private does not answer or does not answer? That’s what I got here. internal…
-
8
votes1
answer2897
viewsWhat is Bind(Include = "Property") used for?
By creating a CRUD with scalfold in ASP.NET MVC, in POST, we have the following code: public ActionResult Create([Bind(Include = "Id,Nome")] Grupo grupo) {...} What’s this one used for [Bind]? When…
-
8
votes1
answer856
viewsWhat is the correct way to declare an asmx Webmethod in C# to receive POST requests with parameters?
I’m trying to set up a file upload process for a web service done on c# .asmx, but I am not able to manipulate the sending of parameters through the method POST. This is the webMethod I created:…
-
8
votes2
answers362
viewsHow do I convert LINQ to SQL for Mysql?
I am trying to remove the use of SQL statements from within the system (to make it flexible as to which database will be used), use instructions Insert, Update and Delete via stored Procedure…
-
8
votes2
answers385
viewsIn which scenario is it recommended to use Keyedcollection instead of a Dictionary?
I didn’t know about the existence of KeyedCollection until you see this reply gypsy. I wondered how and when to use a KeyedCollection, since there is the Dictionary which apparently has the same…
-
8
votes2
answers9392
viewsSerialize object list for JSON: A circular Reference was Detected while serializing an Object of type
I’m trying to Serialize a list of objects to Json and have received the following error: An Exception of type 'System.Invalidoperationexception' occurred in Microsoft.Web.Extensions.dll but was not…
-
8
votes1
answer658
viewsHow to login to the site using Instagram, Twitter or Google+ account on Platform . NET (C#)
I’m looking to develop something of the kind but I have no references to how to do, could help me with some example?
-
8
votes3
answers7123
viewsDisable windows form maximize and minimize
I need a solution to disable the maximize and minimize buttons of a windows form. Using WPF these two attributes would solve: WindowStartupLocation="CenterScreen" ResizeMode="NoResize" But now I…
-
8
votes1
answer3496
views -
8
votes3
answers1704
viewsWhat is the use of Func<T, Tresult>
I was researching some things and came across the Func<T, TResult>, and I didn’t quite understand his usefulness. For example: //Método public string Nome(string nome) { return "Meu nome é " +…
-
8
votes1
answer521
viewsC++ with C#, is it possible?
I have a C++ project using visuals on it using wxWidgets. I was hoping to transfer the look of the project to C#. It is possible to have the programming of the functions in C++, but the programming…
-
8
votes2
answers1180
viewsIs it possible to link a C# form to a VB.NET project?
I have two different projects, one with only one form in C#, I can embed the form in my project in VB.NET ?
-
8
votes8
answers2805
viewsHow to know which is the last element on a list?
I am doing a dynamic sql query, in which I use lists, my problem is, how to know which last element of this list Follow the code made so far: List<string> campos = new List<string>();…
-
8
votes1
answer347
viewsHow to create an html log with log4net
I have a project that already uses log4net, but I would like to show this log in HTML. I searched several sites and nobody implemented this solution. Does anyone have any idea how to do that?…
-
8
votes2
answers121
viewsDeclaration of an interface with Where
I’m studying a lot Pattern design, because I think they solve a lot of things and it is very opportune to study them. I took this statement on the Macoratti website and I confess, I could not…
-
8
votes1
answer124
viewsHow can I allow another application to start mine?
I’ve searched a lot, but I don’t know how to be in the list of applications that can open a certain type of file, for example, a photo. What I want is as if Whatsapp (or any other application) put…
-
8
votes3
answers224
viewsUse of using versus full name
I’ve been following many projects open source and I realized that there’s a really big alternation between using using (Imports in VB.NET) and use direct reference to the namespace. Example: void…
-
8
votes2
answers1854
viewsPagination C# MVC Asp . NET
I have a problem with paging performance with Entity Framework and SQL SERVER, first it does getAll and then list the pagination var bdPergunta = new PerguntaRepositorioEF(contexto); var pergunta =…
-
8
votes2
answers1999
viewsWhy can’t I declare a variable with a numeric before the name?
I’m curious to know why I can’t create variables with a number before the name. I did some tests in Javascript, Actionscript and C#. var 4teste:String = "teste"; //ActionScript, erro! var 4teste =…
-
8
votes1
answer189
viewsDifferent connectionstring for different builds
I have two Connection string, one when I am in development that uses my local bank and the other for when I deploy the application in Azure. I want the app to know which one to use depending on the…
-
8
votes3
answers1242
viewsLINQ with Where condition using variable
I have the following table: USUARIO Nome | Idade João | 21 Maria | 18 I want to do in only one consultation return all users, or return only users of specific age based on a C variable#. Also by…
-
8
votes3
answers2089
viewsHow to implement business rules or system rules using Domain Driven Design in C#?
I’m having doubts on how to separate business rules from system rules with the DDD. If I have for example a Class Usuario with id,nome,login,senha as properties. A domain rule would require a…
-
8
votes2
answers339
viewsWhere to put Data Annotation? View Model or Model?
Using Entity Framework Code First, with view model and model. To create a column with varchar(2), need to put the MaxLength(2) in the model and in the view model?…
-
8
votes1
answer7864
viewsFunction to generate random alphanumeric characters
I need a C# function that manages a String of random alphabetic and numerical characters of size N.
-
8
votes2
answers1152
viewsHow to count words from a string ignoring prepositions?
Is there any service that does the recognition if a certain type of word is a preposition? I want to make a word ranking of a rss feeder, but ignoring prepositions. Ignoring words with less than N…
-
8
votes1
answer3472
viewsUnable to connect to remote server - When consuming C#webservice
I have an application developed in C# that consumes a webservice also in C#. In some cases (not always and not everywhere/customers) when consuming the webservice i get the following error: Unable…
-
8
votes1
answer2080
viewsRandom() generating repeated numbers
I am developing a small application to perform XML import, which searches the items present in the note and performs the search for them in DB company. When the item is not found, the link is done…
-
8
votes3
answers576
viewsSession Limitation to Save Data
I have a query slow in Oracle to list all the accesses of a user, so I thought to record the result in a Session, the average of records returned is 600, it’s too much for a Session? Would there be…
-
8
votes1
answer11054
viewsStreamwriter Special Characters with Encoding.ASCII C#
I am writing in a file via Streamwriter using the encoding Encoding.ASCII. A situation has appeared where I need to write the letter "Ç". Only if I try to do that, the file leaves the character "?".…
-
8
votes1
answer374
viewsWhat is ADO.NET for C#?
I’m starting to learn about C# for web applications, and I wanted to know what ADO.NET is and what are the advantages of using it?
-
8
votes2
answers323
viewsWhat is the @ in a view and controller for?
I program in PHP and I’m starting to learn how to program in C# ASP.Net MVC, but I’m having some questions: What is the purpose of @ (arroba) both in controller how much in the view ? What are these…
-
8
votes4
answers2691
viewsReports with Asp.Net MVC
Hello, I would like to know some options of reports with Asp.Net MVC. I tried to use Reportviewer but it gets typed with the bank and not to use with objects. Would anyone have any suggestions?…