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
-
3
votes1
answer1099
viewsGet Data from Webservice in C#Action
I have an application that accesses third-party Webservice. To improve the testing process, I am setting up a website to simulate Webservice. This site consists of several Actions, which return XML,…
-
3
votes1
answer65
viewsSha1cryptoserviceprovider and Sha1managed return different results
I need to encrypt a string using SHA1. I was able to encrypt using the SHA1 class in this way: public string CriptSha1(string secret) { string result = ""; byte[] key =…
-
3
votes2
answers244
viewsWhat is the best way to publish my C# Asp.NET application on Azure?
I started a project in college and I’m using Azure to host it. This is my first contact with this tool and I’m having great difficulty understanding it. I’ve looked for tutorials and explanations in…
-
3
votes2
answers5016
viewsSession C# how does it work?
What is the lifetime of an ASP.NET MVC Session, and how to find out how to find out the remaining time and how to add more time to Session (if possible)? There is another form of value guard that is…
-
3
votes3
answers919
viewsString Suffix and Prefix. Take a piece that serves both
I need to do a function that returns the Length of a part of the string that is both suffix and prefix. So: Given the string: abbabba, the answer would be 4, because that would be: Prefix: a ab abb…
-
3
votes1
answer430
viewsCrystal Report Runtime is crashing
Hello I am trying to fix an error in my application, I used FUSLOGVW.exe to know which dlls were missing are wrong. It is returning me this msg: But the dll msvcm80.dll hand is part of my project,…
c# windows visual-studio-2012 crystal-reports runtimeasked 9 years, 3 months ago Fabrício Mendes 843 -
3
votes3
answers401
viewsSQLSERVER error in C#application
I have a problem related to the SQLSERVER database. I try to connect from a point to the server and error appears: Instance-specific or network error when connecting to SQL Server. The server was…
-
3
votes1
answer1027
viewsCode First Migrations Mysql - Specify the '-Verbose' flag to view the SQL statements being Applied to the target database
I am creating a web application in C# and because of the hosting server, the database is in Mysql. Then I installed Mysql.Data.Entity, EF6, enabled Migrations, added the Migrations class, but when…
-
3
votes1
answer128
viewsApplication stopping when there are many users accessing
My application is crashing and I don’t know exactly why. The only thing that repair is that when there are many users accessing, or making requests it happens. When it happens I have to restart the…
-
3
votes1
answer127
viewsFormat Combobox value pulled from SQL database (LINQ) in C# Project (WPF)
I need some help with the code below... I need to make the Float value pulled from the SQL Database in the Brazilian format of the Real Number Set in a C# (WPF) project in a Combobox (as Double).…
-
3
votes1
answer1103
viewsRemote connection, C# with SQL Server (2008)
I’m a beginner in C#, and I’m trying to remotely connect my C# application to a SQL Server database that is on another PC (the PC is not on the same network, it’s my friend’s), but it’s giving…
-
3
votes2
answers8139
viewsShortcut to create constructor with parameters
Is there a shortcut in Visual Studio, which creates a constructor, with all attributes created in the class? class Alimento { public int ID { get; set; } public string Titulo { get; set; } public…
c# visual-studio visual-studio-2012 builder resharperasked 9 years, 3 months ago Eduardo F. Santos 449 -
3
votes4
answers815
viewsReflection of an Object that is owned by another
In my code I use a class called GenericField<T> which is used in all attributes of another class called Aplicacao. Until everything well, however, in another part of the code I need to get via…
-
3
votes2
answers400
viewsC# MVC5 - Insert Fields with 4 Decimal Digits
I am making an entry in the database (SQL Server 2008) of a field configured to 'decimal(10,4)', from which I try to insert/edit, by my application C# MVC5, a field of my model of type 'decimal''.…
-
3
votes1
answer209
viewsShow more than one dropdown column value C#
How could it show more than the value of a column of a dropdown? I tried the following method: private void BindDropDownList() { DataTable dt = new DataTable(); string localidade = string.Empty;…
-
3
votes1
answer322
viewsRelationship between the "Initializecomponent();" method and the loading of a "Splash Screen"
I added a splash screen to a project in the simplest way, that is, by changing the property Build Action for Splashscreen. Although with very similar visual effects, what really happens when we…
-
3
votes1
answer504
viewsText overwriting the header
I tagged C# because virtually all the examples found on the internet are in this language and "translate" to vb.net is quite simple. Man report based on the iTextSharp is dynamic. It has a header…
-
3
votes2
answers188
viewsc# query with cycles
Good people I am doing a work in using c# and my knowledge is still very limited and I am having a doubt. I have 2 tables and what I wanted to do was show the information of the 2 where the…
-
3
votes1
answer794
viewsWebservice of the post office for more than one product per freight
Hello, I’m using the webservice of the correctors: http://ws.correios.com.br/calculador/CalcPrecoPrazo.asmx To calculate the freight cost and term. The call is made via JS(jquery/ajax) and the…
-
3
votes2
answers2346
viewsGenerate txt file according to the predefined layout in c#
I need to export data from a class according to a specific layout consisting of size and position. For easy maintenance, I need simple layout change. Follow down my class: public class…
-
3
votes2
answers918
viewsHow to cast a typed class in C#?
I own the class Carro who inherits from the class Objeto and another class CarroTeste implementing the abstract class TesteBase that by its implements the interface ITeste, both (TesteBase and…
-
3
votes2
answers710
viewsWebservices with C#, make-up
I need to create a Webservice to export products. Creating Webservico is fine, but depending on the client, I will have to change the name of the elements. Example, Product Code element: Generic…
-
3
votes1
answer1831
viewsMove character to the point in Unity3d
I have a problem, I need my character to move a certain distance when I click the button, until then I can do. The problem is that when I do, he doesn’t "walk" to the point, he sort of "teleports,"…
-
3
votes1
answer1001
viewsHow to register legal and physical persons in c# mvc?
How I do in Personal Action Create? Personal: [HttpPost] [ValidateAntiForgeryToken] public ActionResult Create([Bind(Include =…
-
3
votes3
answers727
views -
3
votes1
answer308
viewsHow to use Html.Beginform with Javascript/Ajax
I have a View to generate Report on my system and I am using a Beginform. The idea is when I give the Ubmit to my Gridrelatorium, which is another View, press inside one that I have inside in the…
-
3
votes1
answer415
viewsModal bootstrap MVC 5
I’m trying to use the modal of Bootstrap, but I can’t make the window open in modal form with the style of the page, instead it opens as a page with no style and using the whole browser frame.…
-
3
votes1
answer55
viewsIs there any way I can save a site from a published user PC file?
I am creating a zipped file and need to save it to my user, only when I select the location where q is saved the file it saves on the server where the site is hosted. Way string zip =…
-
3
votes1
answer252
viewsMore performative way to return data to the View
In a view where we return a list of objects, and we need to demonstrate the quantity, as a small report, using some conditions. What is the most performative way to return data to view? Explaining…
-
3
votes2
answers89
viewsDeleting items in List
Staff I have a:List<Grupos> lista = new List<Grupos>(); And I have this code var matches = lista.FindAll(x => x.Nome_Grupo.ToLower().Contains(txtFiltro.Text)).ToList(); To filter only…
-
3
votes1
answer231
viewsInsert database record into Datagridview columns in C#
I got a problem, 'cause I got one DataGridView1 and when I read the database records each line should be added in a Column of my DataGridView1. My example DataGridView1 has the columns Column1,…
c#asked 9 years, 2 months ago Joaquim Caetano Teixeira 967 -
3
votes1
answer380
viewsDatagridviewcomboboxcolumn loses selected value
I have a Datagridview and bind it through a list. So far so good... Now I want to add a combobox (Datagridviewcomboboxcolumn) dynamically based on another list. In the first line of code I make the…
-
3
votes2
answers280
viewsHelp with Textbox / string parameters
I have this method where I would like to bring the IBGE. When I put Textbox as a parameter, it usually brings it, but the problem is that I am using a Library and cannot import Textbox. So I…
-
3
votes1
answer60
viewsRepeat loop with pair and sequential output
How can I generate this list in sequential pairs: Array = Itens.text.Split(","[0]); int qnt = Array .Length; for (int i = 0; i < qnt; i++) { TextBox.Text = Array[i].text; i++; TextBox.Text =…
c#asked 9 years, 2 months ago Hebert Lima 987 -
3
votes1
answer844
viewsC# MVC5 - Table with Checkbox and Different Actions
I am working on a project of which I own a page that lists some records, of which I will 'flirt' some to perform batch actions such as deletion, status change, among others. How do I send this list…
-
3
votes1
answer502
viewsNinject does not load dependencies. Asp.NET MVC C#
I’m using Ninjectwebcommom to work with Inject. I installed the package via Nuget and automatically it creates a class named "Ninjectwebcommon" in the App_start folder, as the documentation itself…
-
3
votes1
answer92
viewsHow to add the BUILTIN Administrators group in SQL Server for Operating Systems that are not in English?
During the installation of my application on a server, the following line is executed: using (var com = con.CreateCommand()) { com.CommandText = "CREATE LOGIN [BUILTIN\\Administrators] FROM…
-
3
votes2
answers134
viewsIs it possible to create Webapi without the MVC structure?
The title of the question itself defines my doubt, using VS2015 to create an API, it forces me to create the whole structure of MVC together. So I wonder if there is a way to create the API only…
-
3
votes1
answer68
viewsRemove Return Header Owin Webapi
A simple return query to my REST service brings the following answer: { "Id": 1, "Descricao": "TIROLESA DE AÇO", "Und": "UND", "Fabrica": "STARROW", "Estoque": 9, "Preco": 0.39 }, But the query with…
-
3
votes1
answer36
viewsUpdatepanel - Always and conditional together
I have a question. Is it possible to fire event only on updatePanel conditional while it is inside another that is not conditional? Follow the example: <asp:UpdatePanel runat="server"…
-
3
votes1
answer152
viewsSubstring(string.Indexof) is returning unwanted parts
I’m capturing a music site. I would like to return only 2 artist information and the music. She is in this code snippet: <div class="nowOnAir"> <a…
-
3
votes2
answers489
viewsCheckbox with External Checkbox
I have a Form with a Dropdownlist with Checkbox inside, and I have an external Checkbox that selects and unchecks all. My question is this:. When I uncheck one of the items in Dropdown the "Select…
-
3
votes1
answer89
viewsMight there be some error in the execution of foreach in this method?
The execution of the code below may occur some error? protected void ImprimeValores(Ilist<int> values) { if (values.Count > 0 && values != null) { foreach(int v in values)…
-
3
votes2
answers222
viewsEntity Framework and parameterized constructor
When I create domains, I usually create a parameterized constructor for the same: namespace Models { public class Unity { public string Abreviation { get; set; } public string Description { get;…
-
3
votes4
answers343
viewsWhy not always use Optimize Code?
In Visual Studio there is the option Optimize Code which has the function of creating optimizations performed by the compiler to make your output file smaller, faster and more efficient. Why can’t I…
-
3
votes1
answer915
viewsTest classes with dependencies (C# + Entity Framework)
I have a class "Sell" (summary of the class below) and in it I have a property "Orcamento". What would be the best way to do a unit test in this class? I came across 2 problems: Mock frameworks…
-
3
votes1
answer7943
viewsPass parameter to a C# MVC Controller
I am learning programs in ASP.NET MVC C# and would like to know how I pass a data from a textbox to a controller. That is, I want to enter a value(id) in the View Index in a textbox and when I click…
-
3
votes1
answer2091
viewsMake a button to add properties to a list using Begincollectionitem C#
I have a register of people and need to create a button to add multiple phones and send to my controller, I am using Begincollectionitem, based on my other question Form using Begincollectionitem…
-
3
votes1
answer151
viewsIterations within Transactionscope
I have an Asp.Net MVC project with Entity Framework 5.0 in . Net Framework 4.0. What are the losses caused by a TransactionScope very long? I have the following code snippet: using(TransactionScope…
-
3
votes1
answer1367
viewsConvert MER (Entity Relationship Model) diagram to VB.NET or C#
I developed the diagram of the tables of the layout of the XML of Nfe, are 58 tables with its relationships. I would like to generate the classes automatically from the diagram or it can be through…