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
answer432
viewsView table by foreign key in C#
So, I have a Pizzeria project and I have some tables, such as: Customer Registration, Employee Registration, Order Registration and etc. I’ve already created a Customer and Employees table and…
-
2
votes1
answer73
viewsSummary in classes and methods
How important the use of <summary> in methods and classes? How impactful this is at the level of development? Which is the good side and which is the bad side of its use?…
-
2
votes1
answer135
viewsProblem with Viewbag and Viewdata for Breadcrumb Creation
I need to return from my controller to my project view data to assemble the breadcrumb (structured navigation). My problem is: If I send by Viewbag or Viewdata or Tempdata, and the user is using two…
-
2
votes2
answers620
viewsAutomapper with Expression
I am making a generic repository and came across the following situation. In this call I can do the mapping and it works perfect. public IEnumerable<PaisViewModel> GetAll() { return…
-
2
votes2
answers394
viewsblocked by software Restriction policies?
Someone has come across this message when opening Visual Sdudio?? \Packages Entityframework.5.0.0 tools init.ps1 cannot be Loaded because its Operation is blocked by software Restriction policies,…
c# visual-studio-2013 visual-studio visual-studio-2012asked 8 years, 12 months ago Luciano Carlos 335 -
2
votes2
answers133
viewsServer changes no effect
I have an application running c# with . net 4.5 on IIS 8. I’m editing a Controller (which is a .Cs file). However, I edited some things in this Controller and saw that these changes were not…
-
2
votes2
answers173
viewsCreate project file like . psd, . sln, a own, etc
I wonder how it works to create these types of files, sln, psd, project files, photoshop psd, visual studio sln, I want to create my own kind of project, I tried to search on Google, but, I did not…
c#asked 8 years, 12 months ago Adelson Rocha 39 -
2
votes1
answer701
viewsWindows Service 'System.Typeinitializationexception' on startup
Hello, I am creating a windows service to perform a backup job. I have created other services before but never had a similar problem. Everything was going well, during the development I installed…
-
2
votes1
answer3478
viewsConvert string to Datetime
How to take from a string something like "30/01/2015", for example, and convert it to datetime and maintaining the same date format? You can validate the date.
-
2
votes1
answer386
viewsI am unable to open a byte array extracted from the database!
Language: C#/ASP.NET Database: Postgreesql Component used for file upload: Fileupload Below is the component: Below is the method to perform the insertion to a table in the database that only has…
-
2
votes1
answer372
viewsHide Tray Icon Menu
I created a menu for my TrayIcon: However, if the user does not select an option, it is still visible. Would anyone know how to hide if the user clicks outside the menu area? Here’s the code I’m…
-
2
votes2
answers54
viewsForce the subclass
as a tool to force the subclass to display the correct data? class Program { static void Main(string[] args) { var tran = new List<Transporte>(); tran.Add(new Navio()); // Objetos das…
c#asked 9 years, 5 months ago Thiago Resende 21 -
2
votes1
answer95
viewsSame different result code (Visual Studio 2012 X dotnetfiddle.net)
Follows image with the results on both platforms, has some explanation or is a bug in the online compiler? Both are console application, the only difference is that in VS is being compiled with…
-
2
votes1
answer4409
viewsDatetime "Null" = 01/01/0001
How to treat a field DateTime that comes as "null" (I know that DateTime can’t be null) of a legacy basis? Consulting a WebService it returns a field DateTime as 01/01/0001 (no value) in the case of…
-
2
votes1
answer480
viewsHow to identify patterns in colors?
I have an image and loop through each pixel of it. I need to identify if the pixel color: - It is a light or dark color; - And the hue of it (for example if it is bluish or reddish, greenish,…
-
2
votes0
answers109
views"Error" loading date
I have a screen whose a certain "Reference Date" field receives the next available date of a file, following the dates that are in the database. On the field side I have a "Calendar" icon that when…
-
2
votes1
answer712
views -
2
votes2
answers1410
viewsRemove all records from a table with Entity framework 6
How to delete all data from a database table using EF6 without having to query (I want to delete all records)?
-
2
votes3
answers3217
viewsHow to read an excel file in c# and save the data in strings?
Guys, I need to make a c# console application that reads an Excel and saves each data in a string!! I’ve tried several libraries and nothing has worked out
-
2
votes1
answer1754
viewsHow to translate Summary errors Asp . net validation error messages?
I can’t find a file that brings me the error message strings to be translated, the Annotation are well, only those that bring more complex errors, such as Passwords must have at least one Digit…
-
2
votes1
answer63
viewsDoes Not Record IIS error System.Diagnostics.Xmlwritertracelistener
I did a test project on Github to demonstrate Log working with System.Diagnostics.Xmlwritertracelistener everything works on my machine, but when I play on the server only records information and…
-
2
votes1
answer111
viewsSNS AWS in . NET C#
Someone has already implemented SNS in AWS with C#? I implemented the code below in an attempt by sending by topic created by the console, but need to do everything by our ADM on . net. Follow the…
-
2
votes1
answer60
viewsIf there is update a table and insert into another, if not, insert into the two
How to make an expression using EPH so that when a certain list of objects is sent and already exists in the database, it is updated and the change is inserted in another historical entity,…
-
2
votes0
answers19
viewsWebservice asmx does not return JSON, only XML
I wanted to solve this problem, the return of my webservice, returns with the JSON body, but the XML header. how do I return the structure in JSON ? I’ve read all the internet and can’t understand,…
-
2
votes1
answer280
viewsHTML Parser in Xamarin
I am developing an application with Xamarin to make login in a web account using HTTPWebRequest and filter relevant site information to an app. I’ve already developed the part of doing login, now I…
-
2
votes3
answers337
viewsRecover MAX value from an SQL column
string var = ""; SqlConnection con = new SqlConnection(Banco._strCon); string sql = "select max(end_id) from endereco"; SqlCommand cmd = new SqlCommand(sql, con); con.Open(); SqlDataReader dr =…
-
2
votes1
answer106
viewsSpinner - Xamarin
I need to create a spinner by programming code and define: layout_height: match_parent layout_weight: 10 layout_width: wrap_content Spinner sp = new Spinner(this); sp.Layout_height ???…
-
2
votes1
answer203
viewsChoose which items of a enumerator appear in an Enumdropdownlistfor
There is how to select only a few items from the enumerator to send to a EnumDropDownListFor ? Ex: public enum Documento { CPF = 1, RG = 2, CNPJ= 3 NASCIMENTO = 4 } And I would like that in a…
-
2
votes1
answer115
viewsProgress within a Task
How can I modify the values of an interface control within a separate task from the main thread? Example: private void button1_Click(object sender, EventArgs e) { Task task = new Task(Processar);…
-
2
votes1
answer90
viewsSearch all table fields in an Action
I would like to know how best to prepare a query that searches in all fields of a table. Let’s say I own a news site, and on this site I have a input for Search in my template. When entering the…
-
2
votes1
answer346
viewsBillet generation
Hello, I need to generate billets in an application. I’ve never worked with billet generation. Could someone explain to me where to start, what are the first steps, the path of the stones? I gave a…
-
2
votes2
answers1348
viewsHow to show the largest number typed, using functions?
#include <iostream> using namespace std; void maior(int a, int b); int main() { int cont, maior1; do { cout << "digite um valor: "; cin…
-
2
votes2
answers4895
viewsPass parameters to the Controller via @Html.Action
I need to render one View into another, but this rendered View needs to receive and display data from the database, so I’m going to use @Html.Action for this, but I need to pass a parameter to the…
-
2
votes0
answers60
viewsHow to pass the value of a position to a variable, this position being received in ASCII?
So I send you a piece of my script so you can help me. I need to return the variable rsp, that has always brought the value equal to 0, which was not to be done. // Envia comando de Leitura de…
-
2
votes2
answers111
viewsI’m not getting wheel the first animation of my game
Good afternoon I’m having a hard time understanding what that mistake would be I still have a few days in the programming world someone can help me using UnityEngine; using System.Collections;…
-
2
votes1
answer171
viewsReporting
Good night, should be simple thing, but I’m breaking my head and it’s not going. I made a report of the college project "Input Parts in Stock" and is working perfectly. When I did the tests the…
-
2
votes0
answers37
viewsHow to run a method daily automatically
How can I create an automatic routine in my application to run a particular method every day at 08:00 am in the morning, with the aim of updating a field in a table of my database?
-
2
votes1
answer1229
viewsEmbedded database with C#
I’m developing a local app for desktop. As there will be no database servers, I studied some, such as Firebird, Sqlite, Access and even Localdb. But I still feel "lost" in which to work. I know the…
-
2
votes2
answers325
viewsInterpret replies from responsive card
I would like to know if there is a library capable of processing a scanned image of a reply form (similar to the one used in ENEM). I have found a software that is capable of doing this, which is…
-
2
votes1
answer124
viewsHow to apply mask in these cases?
How to put mask on item @item.CPFCNPJDevedor? @foreach (var item in Model.Result) { <tr> @if (Permissoes.Where(x => x.Acao == "EditChassiCrvGravame" || x.Acao == "VisualizarChassi").Any())…
-
2
votes1
answer421
viewsC# : Show Thumbnail without resizing the image in ASP
I don’t want to let to decrease pictures by setting width and height on Asp. Example: <asp:Image Width="70" Height="90" ID="Image1" runat="server" ImageUrl=' <%# @"\imgpe\" + Eval("CODFOTO") +…
-
2
votes2
answers1466
viewsEntityframework complaining of Identifier duplicity even with the property being null
I have the following classes: Product: public class Produto { [Key] public int Id { get; set; } [MaxLength(70)] [Required(AllowEmptyStrings = false)] public string Descricao { get; set; }…
-
2
votes2
answers53
viewsCheck if directory is a repository with Libgit2sharp (C#)
I’m starting to study C# so my knowledge is very limited. I’m using the library LibGit2Sharp and I would like to check if an informed directory is a repository. Their documentation is not yet…
-
2
votes1
answer43
viewsChange DB4O data to C#
How to change a data from a "table" created in Db4o? For example, I have the following object recorded in DB4O: Nome = Emerson Senha = Teste I want to change only the Password data for example from…
-
2
votes2
answers4336
viewsHow to run program in C# by cmd
I am creating a program that works with commands, and I would like this program to be executed by cmd style: c:\path\folder>meuprograma >comando arg1 arg2 >comando 1 falhou >comando2…
c#asked 9 years, 4 months ago KaduAmaral 11,472 -
2
votes1
answer1215
viewsConvert a file . pdf or . P7s to Base64 in C#
I want to convert a file . pdf or . P7s to Base64 in C# which should be loaded in XML. How can I do? EX: <conteudoArquivoP7S>…
-
2
votes1
answer692
viewsHow to disable keyboard in C# Windows Form?
Good Guys, I’m facing a problem with my application when I press the ALT key, I’m not expecting any kind of interaction through the keyboard, but even so exclusively this key gives this error So I…
-
2
votes3
answers757
viewsError while updating data
I have a base repository where I only perform CRUD. When working with one data at a time, it works normally. However, I needed to make a modification and send several records to be edited at once.…
-
2
votes1
answer640
views@Html.Actionlink submitting Post MVC form
@using (Html.BeginForm("MinhaAction", "MeuController", FormMethod.Post )) { <div> <table> <thead> <tr> <th>Empresa</th> <th>Cliente</th>…
-
2
votes1
answer62
viewsHow to see object in c#
Hello, how can I see my object in c#, as the var_dump() in php, an example, to show the objects' orientations, follow my code: [HttpPost] [ValidateAntiForgeryToken] public ActionResult…