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
-
1
votes0
answers736
viewsRemove a user from a group in AD using . net + powershell
Hello, I am trying to remove users from a group in AD from a Powershell script, within an Asp.net MVC application. I have a similar script and function to add a user in AD, but the removal of users…
-
1
votes1
answer192
viewsWrite ; in . CSV without separating the cell
I have a C# project that is normally generating a file with extension. CSV, however I want to write a ;(point and comma) but it does is to separate the cell. There is some way to write without that…
-
1
votes0
answers31
viewsSignedxml in NET 2 vs. NET 4.5
I have a web application in Asp.net, which consumes a webservice in Delphi and that it uses a DLL created in C# to perform signatures. With the web application installed on IIS, it shows an error.…
-
1
votes0
answers29
viewsWord Web Add-in - Footer content alignment
Hello! I am developing an add-in for Word, following the template in visual studio. Today, with the code to follow, I have the result almost finalized. However, in Footer, I can not in any way (of…
-
1
votes1
answer195
viewsFunction call dll C# (VS2010) using COM in Delphi 5 does not pass the parameters correctly
Good morning, I created using Unmanagedexports a dll in c# (Visual Studio 2010) to be consumed in a form Delphi 5, as per: C#: using System; using System.Collections.Generic; using System.Linq;…
-
1
votes3
answers132
viewsError concatenating component value in query
As darlings in my C# Winforms project are being carried out through StringBuilder. It was suggested here in the O.R. query of Consulta.Append("Select * from...") for @"select * from..." for being…
-
1
votes1
answer645
viewsCreate Dropdownlist with Viewbag
I’m getting the following error: Invalidoperationexception: There is no Viewdata item of type 'Ienumerable' that has the key 'Office'. Here I search from the database: public…
-
1
votes0
answers100
viewsUse 2 models in a View, but separate them in the form submission
I’m getting the following error: 'Addemployeeviewmodel' does not contain a Definition for 'Officeemployee' and no Extension method 'Officeemployee' Accepting a first argument of type…
-
1
votes0
answers29
viewsMvvmlight Event to Command using Model for Command Parameter
I’ve been trying to use Mvvmlight’s Event to Command to link my Viewmodel commands to events like Textchanged from Textbox, for example. But Event to Command automatically assumes that the Command…
-
1
votes1
answer108
viewsRead user input via Javascriptexecutor or promt in Selenium Webdriver C#
I have 4 test environments. When executing the Selenium script, I want the user to inform soon after the browser opens, in which environment the script should be executed. So the script will direct…
-
1
votes1
answer144
viewsOutput Cache ASP . Net MVC
I am studying on the output cache in Asp . NET MVC to improve the performance of my application. From what I’ve seen it can be stored in many places like: · Any · Client · Downstream · Server · None…
-
1
votes1
answer44
viewsHelp with Linq Method using group by Dinâmico
I need to mount a dynamic graph from a filter panel and two fields select that can be crossed. I already have the structure that goes to the graph and how I need to return from backend. In the case…
-
1
votes2
answers923
viewsAccess object attribute passed as generic parameter
In my application I have a chained list class that takes a generic parameter, which is the type of value the list will store. In this case, I am passing as parameter the class Usuario, I need to…
-
1
votes2
answers1085
viewsReturn to previous menu
I’m trying to add a "Back" from one menu to the other, first tried using the do only in the 2nd. menu to return to the first, but it only closes. Follow the whole code: namespace ConsoleApp10 {…
-
1
votes1
answer211
viewsHow to work with Foreign Keys in C# ASP . NET Core?
Good night, you guys. I am a beginner in C# ASP . NET Core and I am facing problems with Foreign Key. I need to popular a combobox with data from a database table. Next is my Seller model using…
-
1
votes1
answer59
viewsAdd a new variable to a component (Picturebox)
I’m creating a game for a college job, this game consists of several Picturebox, one is the main character who walks, jumps and shoots, the PictureBox of the shooting and the PictureBox of monsters…
-
1
votes0
answers115
viewsSigning an xml with digital certificate
I’m trying to sign an xml file from an NFS-e. These are the functions that I’ve been assigned: public static MemoryStream stringToStream(string dados) { MemoryStream memoryStream; try { byte[]…
-
1
votes1
answer104
viewsHow to go through Checkbox in automatically generated Webforms with Jquery
How to scroll through several Checkboxes in the C# Button Click event where these Checkboxes were automatically generated with Jquery ? The automatically generated Checkbox HTML is this: <div…
-
1
votes1
answer202
viewsError saving monetary values in Mysql database
I have a table column from my bank called salario_base where it is of the type Decimal(7,2). I enter the value in a textbox, I convert the same and pass this and other variables to an insert class…
-
1
votes1
answer267
viewsHow to mix parameters within an HTML.Beginform ASP.NET
I got the following Html.BeginForm(Don’t take into account if it’s incorrect is a legacy code and I can’t refactor it now). using (Html.BeginForm("Confirm", "Download", new { ContributorID =…
-
1
votes3
answers143
viewsC# - Know location of database file dynamically
I am making a program using C# in WPF, and I need to access the database dynamically, in this case I am using a .mdf.file. In code I have connectionString like this: string stringConexao = @"Data…
-
1
votes1
answer821
views -
1
votes1
answer192
viewsSave XML without formatting
I need to generate the xml, but without skipping line, the way I Gero he is all identado, as I do to save without skipping the line? document.LoadXml(soapEnvelope); document.Save(@"E:\nota.xml"); I…
-
1
votes3
answers283
viewsNo Fill new column as Null, yes with specified value in script
I have a specific table in the database, in it I keep information of classes that are created, swimming classes, futsal classes, weight training classes and so on, it is already in use and with…
-
1
votes1
answer60
viewsSending form with Asp net mvc5
Good morning, I have a form to send where the button is outside the form, this form has 50 different fields, I did in html and I need to receive this data via post in a controller c#, but I have no…
-
1
votes1
answer61
viewsRead a txt file (Ping Application)
I have a txt file that each line contains the ip plus the server name: Example: Ip;userName (1st Line) Ip;userName (2nd line) Ip;userName (3rd Line) What I intended was that my program would read…
-
1
votes1
answer305
viewsEntity - Infinite loop in JSON conversion
What happens I’m having a problem using Entity with my application MVC. What happens is that when converting a class to JSON the program enters an infinite loop and ends up returning no-content…
-
1
votes1
answer106
viewsForeach or for inside an Anynimous Type C#
I am mounting a return of an Api on JSON, And the comeback I ride in Anynimoustype I believe that’s what it’s called, in it I name the variables as they go to Json, but I needed to make a foreach to…
-
1
votes1
answer62
viewsHow to force an event to occur from an extension method?
I am creating a C# application and I am using the interface INotifyPropertyChanged thus: public class Test: INotifyPropertyChanged { private int foo; public int Foo { get => foo; set =>…
-
1
votes1
answer807
viewsXSD.EXE Generate classes in C# - EFD Reinf v1_04_00
I am trying to generate XSD.exe classes in C# from the Reinf XSD files: EFD Reinf v1_04_00 http://sped.rfb.gov.br/arquivo/show/2802 As follows: C:\Reinf\XSD>xsd evtInfoContribuinte-v1_04_00.xsd…
-
1
votes1
answer71
viewsList item for loop variable C#
Is there any way I can make one for or foreach in a list and within this I create variables for my obj items EXAMPLE: public class Pessoa { public int ID {get;set;} public string Nome1 {get;set;}…
c#asked 5 years, 11 months ago LeoHenrique 954 -
1
votes0
answers143
viewsError while converting Delphi function to C#
Good evening, everyone! I’m trying to convert a Delphi function to c# and I’m getting it, where am I going wrong? Delphi code: function TCriptografa.CriptoBinToText(SText: string): string; var SPos:…
-
1
votes0
answers35
viewsUnderstanding the Crossword Puzzle Algorithm
I have this algorithm below, I wanted to know if I made a correct understanding, if it is very superficial and so have something else to add. My understanding of the algorithm is being made explicit…
c#asked 5 years, 11 months ago gabrielfalieri 1,231 -
1
votes0
answers56
viewsError to map in Entityframework
Good, I’m trying to map a database using Entityframework-Reverse-POCO-Code-First-Generator and one of my views has the following mapping: public VIEW_CODE_NAV_CustomerLedgerEntryMapping(string…
-
1
votes0
answers70
viewsDoubt with LINQ to Entities
What would this query look like in LINQ to Entities: SELECT COUNT(cont) qtde_resp , pergunta , resposta FROM pesq_respostas WHERE id_pesquisa = 9 AND Tipo IN ('Intervalo', 'SimNao') GROUP BY…
c# sql entity-framework lambda-expressions linq-to-entitiesasked 5 years, 11 months ago alessandre martins 998 -
1
votes1
answer59
viewsBinding with Customcontrol is not working
I created a Customcontrol but creating a Bindingproperty I cannot perform a Binding Custom Control XAML code <ContentView xmlns="http://xamarin.com/schemas/2014/forms"…
-
1
votes1
answer61
viewsencoding formatting . net
all right? With a problem that is as follows: I recover the html of a legacy system and, I need to change this html pa then return to the browser with the new html. But when I recover this report…
-
1
votes0
answers62
viewsIgnore Icollection Automapper property does not work
I’m having trouble ignoring one property that’s like Icollection and another that’s like Generic Class. Type I am ignoring in Profile Map Address class, it works only when Map…
-
1
votes2
answers3021
viewsHTTP Status 415 - Unsupported Media Type
Follows code: var httpClient = new HttpClient(); httpClient.DefaultRequestHeaders.Add("Accept", "application/json"); httpClient.DefaultRequestHeaders.Add("Authorization", $"Bearer {accessToken}");…
-
1
votes1
answer56
viewsRename files from a txt list
I am trying to develop a small program that allows me to rename a set of files (pdf type existing in a given directory and whose name is sequential: 001.pdf, 002.pdf, 003.pdf, etc.), using existing…
c#asked 5 years, 11 months ago Paulo Ferreira 25 -
1
votes2
answers81
viewsError while searching with Entityframework
I’m having a problem with a request, in the controller when I query the products table appears the following message when debugging, I click on an icon and does not return any data, but the table…
-
1
votes1
answer915
viewsHow to request via c#? Webrequest vs Httpclient
I have a project in . Net Framework 4.6.1, and in my research I concluded that I can use the class Webrequest to request other web services via backend. I wish I could make requests using any http…
-
1
votes1
answer364
viewsError in the shaman saying that the type was not found
In my shampoo I have: <?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"…
-
1
votes1
answer438
viewsGet data return xml
I am trying to return the data of this xml: <?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?> <GerarNfseResposta xmlns="http://www.betha.com.br/e-nota-contribuinte-ws">…
-
1
votes1
answer281
viewsDynamic table MVC
I need to return the result of the trial, I put a fixed value just to perform my tests but it will have an input typed, in datepick. However I cannot create the list for the columns. Follow the code…
-
1
votes1
answer134
viewsError Webrequest c#
I am making a POST type request for a URL, but I always receive as an error the following message "The underlying connection was closed: Unexpected error in an upload.". This request is made through…
-
1
votes1
answer73
viewsReceiving and handling data from a query
I would like to know how to manipulate the data of a query. I have a method that performs a Select, and I’m creating a List to store the results, and return this list. But how can I use this data…
-
1
votes0
answers62
viewsImport Excel that does not have standard for SQL SERVER with C#
I have the following scenario: I have an Excel spreadsheet that is provided by several private companies. This spreadsheet contains social security data. The problem is this: I have columns that…
-
1
votes0
answers30
viewsProblem with Bindind + Keydown C# WPF
I have in XAML a combobox and a textbox, being them: <Label Grid.ColumnSpan="4" Content="Tipo Filtro" Grid.Column="0" Grid.Row="0" Padding="0" VerticalContentAlignment="Center"/> <ComboBox…
-
1
votes1
answer758
viewsIgnore files when uploading to repository
I have a . net core project in bitbucket and I use visual studio 2017 to do the operations next to the repository. The problem is that even without me having made any changes to the project, when I…