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
answers60
viewsGood Practices and Use of Datetime in Viewmodels List
I’m making a system for the client, and he dismissed the use of fullcalendar, which would be practical. With this, I created in a table with the fields Agendaid(int), and Scheduling(Datetime) years…
-
1
votes0
answers35
viewsProblem sending View information to Controller
I’m doing a simple CRUD on ASP.Net MVC and implemented a search box to search for a product in the database. But when I click search, the Viewmodel item passed in the Taghelpers is not sent to the…
-
1
votes0
answers141
viewsInterface and heritage in Xamarin - System.Invalidcastexception: Specified cast is not Valid
Greetings! I’m developing a Cross Platform project in Xamarin. This project consists of consuming a web-service method that will return the script code and an address array that corresponds to the…
-
1
votes0
answers14
viewsHow to use using "Renci.Sshnet" in Vscode on Macos?
using System; using Renci.SshNet; namespace SSHTest { class Program { static void Main(string[] args) { SshClient cSSH = new SshClient(args[1], 22, args[2], args[3]); cSSH.Connect(); SshCommand c =…
-
1
votes2
answers241
viewsI cannot change font size in C# (Property or indexer 'Font.Size' cannot be Assigned to -- it is read only)
I did a Trackbar to change the font size in Visualstudio Express 2015,but when I try to change the font it returns the error "Property or indexer 'Font.Size' cannot be Assigned to -- it is read…
-
1
votes1
answer57
viewsMake effect timer in Unity
hello I am making a 2d platform game in Unity and I made an item that to Oce Pegalo Oceoce will be able to jump higher but I would like to put a timer (I don’t want it to appear on the screen)for…
-
1
votes0
answers67
viewsBlazor | Service Registration Error - Microsoft.AspNetCore.Components.WebAssembly.Rendering.Webassemblyraddress[100]
Hello, I’m taking the first steps on Blazor and following an example I saw on the internet, which makes the Load Menu and Submenu straight from the data bank, I’m having problem at compilation time:…
-
1
votes1
answer256
viewsClick the Follow Instagram button with Selenium C#
I would like to know how to press the follow button of Instagram with Selenium, I have tried several ways and none I can press. Always says or that the element is not clickable or cannot find the…
-
1
votes1
answer83
viewsStock Control - "Database locked"
I am doing a C# inventory control and the idea is that when the user clicks a button, the amount of a record in Datagridview is incremented. The first time I press the button, it updates perfectly.…
-
1
votes1
answer48
viewsAngularjs: Request $http to consume the domain’s external API giving error
I have an Angularjs application that logs in. I am trying after logging in, requesting an API that I am running on my machine running in C# to at least be able to communicate with it. But it made…
-
1
votes1
answer52
viewsDeserialize JSON with null Safety in C#
A little bit of context: I have a C# 8 project using a resource called Nullable Reference Types. When this feature is enabled in the project settings (csproj) compiler treats all class instances as…
-
1
votes2
answers56
viewsHow to insert a List<> into a Listview C#?
I’m trying to insert a List<> (Generated by another class that brings the data from the Database), the data is inserted but the ListView receives only the first column, and the other is null.…
-
1
votes1
answer23
viewsI can’t insert a Dropdown box in C# . Net Core, is there a type conversion error?
Error: Runtimebinderexception: Cannot implicitly Convert type 'Object' to 'System.Collections.Generic.Ienumerable<Microsoft.AspNetCore.Mvc.Rendering.Selectlistitem>'. An Explicit Conversion…
-
1
votes2
answers93
views -
1
votes1
answer85
viewsAbstract class to access elements from an object collection
I’m doing my first project on C#, I’m creating data from a multi-object JSON file that contains basic information from a file (Filename, Datacreation, Size). Filing cabinet jsonArquivos.json: [ {…
-
1
votes1
answer97
viewsWhat is Ienumerable.Getenumerator in C#?
I was reading this documentation and I came across the following piece of code within a class that implements IEnumerable: // Implementation for the GetEnumerator method. IEnumerator…
-
1
votes0
answers23
viewsUnity3d Because my camera is rotating sharply, character even keeps blinking
I made a camera for my game in third person, but when it rotates together with the player, the player sometimes goes away, it seems as if the fps goes down (but it’s just impression). I have done…
-
1
votes0
answers17
viewsI uploaded a web application in C# Asp net and the following is occurring
Server Error in '/sistemas/manutencao' Application. ________________________________________ Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster,…
-
1
votes1
answer42
viewsChange color Repeater cell
I’m making a system ASPNET c# WEBFORM, and food a REPEATER with information coming from the database. I would like a certain cell to have a certain color, according to information coming from the…
-
1
votes1
answer59
viewsCS0747 Error with C#declared
I have created a list that receives my command object powered by the fields of my Forms, my class: public class Comanda //Essa classe carrega tudo necessário para o pedido. { public int idComanda {…
-
1
votes1
answer364
viewsUsing jquery field mask in ASP.net Core MVC
I am working on a CRM project with C# Asp.net core with Mysql and I am already with bank ready and everything straight and I made the client registration form and I am in the validation part now. I…
-
1
votes0
answers40
viewsCreating a command line with multiple arguments using Dsharpplus?
I am starting to program in C# and as a personal project I am creating a data scrolling Discord Bot using the DSharpPlus. My problem is how to identify arguments (I don’t know if I’m using the right…
c#asked 3 years, 11 months ago Diego Miguel da Silva 11 -
1
votes1
answer64
viewsHow to select specific files in a folder?
I’m making a Console Application in C# which, given an array of file names it returns the address of each and adds them to a Dotnetzip Zipfile. Currently I code lies like this: string[] nomes = {…
-
1
votes0
answers32
viewsAdd a line in a Datagridview with a QUERY as Datasource
First I created a DGV and configured it the way I need, put the column names and formatted column by column the way I need, adding the default value for null, text formatting, type of input, etc..…
-
1
votes1
answer216
viewsHow to consume data from an api to show on the front end using Razor pages?
I’m a beginner in development. net core and I am developing an application that consumes data from an api and shows to users, but I can’t convert JSON to OBJECT and crunch everything into a…
-
1
votes1
answer64
viewsHow do I not need to request the api all the time?
I’m a beginner in development. net core and I am developing an application that consumes data from an api and shows to users, but I need to update the site all the time and it takes a little time.…
-
1
votes1
answer96
viewsRun unit test with memory database and fromsqlraw is giving error
I’m trying to build a unit test with . Net Core 3.1 and using Xunit. It turns out I still don’t have a database and so I use the UseInMemoryDatabase. Turns out when I make the call from PROC, I get…
-
1
votes1
answer31
viewsMongo BD timeout with Aspnetcore hosted on the smarterasp server
I have a web api on Asp Net Core performing reading on a non-relational basis on Mongo DB. Running the application locally with the connection pointed to the Atlas Mongo DB server works perfectly,…
-
1
votes1
answer37
viewsMy algorithm generates a SHA512 Hash displays an unexpected result
I have the following string:…
-
1
votes1
answer117
viewsProblem to fill date field with ASP.NET MVC, Razor
I’m making a mini registration system, it has the place to edit a client’s registration, when I click edit it comes the data in the fields for me to edit, all fields comes normal, except the field…
-
1
votes1
answer38
viewsError C# System.Indexoutofrangeexception
Good with a doubt in this code , he in line 14 of me an error as you can see in the photo ... Solutions ?? Thank you Code: using System; public class Exercise052 { public static void Main() {…
-
1
votes1
answer89
viewsHow do I get value from an internal object in a Json file?
I would like to know how to access an object inside the json, follow the code: { "data": [ { "id": "or_asdasdasdasd", "code": "5d6f4sa56df", "amount": 800, "currency": "BRL", "closed": true,…
-
1
votes0
answers22
viewsSwap array type variable between 2 Webforms
I’m making a website in ASP.NET where I have an array type variable of type int in a Webform (we’ll call it Default.aspx.cs) and would like to pass this variable to another Webform (Data.aspx.cs). I…
-
1
votes1
answer34
viewsAutomating in Selenium with C# an Angular 6 page that has no fixed element
Good afternoon, I am trying to create some automated tests on a page that does not have fixed Ids, the only safe way is being Xpath but the same will change as soon as a new button enters. Currently…
-
1
votes2
answers133
views.Net Core 3.1 - How to use Enum to replace code string
Separate file: public enum LANG { NOT_SET = 0, ENGLISH = 1, PORTUGUESE = 2 } File in which I want to put Enum that is currently being validated with string: public bool Validate(StructuralData data)…
-
1
votes0
answers39
viewsIs it possible for an entity to have 2 N-to-N relationships using Entity Framework?
I have 2 models: Cliente and Empresa, which need to have registered addresses. I created another template called Endereço to make the relationships N for N, in which it stayed this way: public class…
-
1
votes0
answers28
viewsHow to pass the id date to the controller without allowing the user to do screen manipulation?
Knob: <a id="btnExcluir" type="button" class="btn btn-icon-toggle" data-toggle="tooltip" data-placement="top" data-original-title="@UtilResources.VIEW_TEXTO_EXCLUIR_REGISTRO"…
-
1
votes1
answer25
viewsHow to exclude the answer from an if if the input applies to another if?
For example, I was studying and I came across the following problem: If I do a little program to tell me if a number is multiple of 2 and 3, they will have numbers that will be multiple of both. The…
-
1
votes1
answer91
viewsGenerate Token API access
Good morning, I will send a link through my system for the client to have access, until then everything is ok, however I wanted to send a token to validate, along with the link, and when the client…
-
1
votes0
answers27
viewsWeb method query in Asp.Net
I’m making a query to plot the data in the chart Highchart, with interval of up to 1h the query is ok, but of 1h is already slow to generate the chart. [WebMethod] public static string SENSORES() {…
-
1
votes1
answer75
viewsHow to open a . txt file and play text for my Textbox in Winforms?
Hello, everybody! For study purposes, I created my own custom notepad, it can open files and get the text of a common Windows notepad through Openfiledialog and transfer to my program. However I…
-
1
votes2
answers123
viewsUpload c# files to API
Hello! I was sending files doing POST for Azure Devops (documentation) via Javascript (just to test some features): var request = new XMLHttpRequest(); request.open('POST', url, true);…
-
1
votes2
answers49
viewsResult of the same account is different in VB and C#
I’m trying to use a formula that gives me the expected result in C#, when translating the code to VB.NET the result is completely different. I’m almost sure I did the translation correctly. I forgot…
-
1
votes0
answers49
viewsRelationship 1-1 and circular reference
I’m running a very simple test, where I have two entities with a 1-1 relationship between them: public class User { public int Id { get; set; } public string FirstName { get; set; } public string…
-
1
votes0
answers95
viewsHow should I test an EF core repository with xunit
I’m currently testing a repository as follows: public class SomethingTest { [Fact] public async void GetKeyValuesAsync_NotNull() { // Arrange var categoryRepository = CreateRepository(); var fixture…
-
1
votes0
answers59
views -
1
votes0
answers34
viewsHow to change the Postbackurl path of an Asp. Button?
I have the following situation: on my page . aspx I have an Asp.Button that, after running an Onclick event on Behind, runs a Postbackurl to another page carrying information through Hiddenfields.…
-
1
votes0
answers37
viewsHow, after a POST request, to insert values into another table automatically with the Entity Framework
Good night! I have the following question: I have 3 tables (Students, Etapasala, Classroom) As you can see, Etapasala is a connecting table between the student and the classroom. I’m using the MVC…
-
1
votes1
answer90
viewsCORS policy . net core and angular 8
I’m having problems with CORS policy. I pulbligated a site on IIS and did not put host name (accessed by IP). When I put the host name (www.nome-do-site.com) the system stopped working and the…
-
1
votes1
answer72
viewsThe Viewdata item that has the 'Name' key is of the 'System.String' type, but must be of the 'Ienumerable<Selectlistitem> type
Speak, guys, I’m new in the area of ASP.NET and studying Identity I came across a typo error when performing a new user registration. The project was done with the authenticity of the VS. I did the…