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
answer1013
viewsHow to do date search through dateTimePicker?
How to search through a dateTimePicker (with Valuechanged event) dates entered in a Data Grid View? When I press the year I want all the records for that year to appear, then press the month and all…
-
2
votes1
answer154
viewsJSON conversions
I’m a beginner in C# and ASP.NET, and I’m having doubts about JSON and dictionaries I have a serialized Dictionary that was stored in the database with: var json = new…
-
2
votes2
answers779
viewsHow to set read-only line of Gridview made with Devexpress?
I need to put the lines of my GridView as read-only. I mean, I have one GridView which already contains some data, this data cannot be edited, but I can add new lines, and these new lines can be…
-
2
votes0
answers40
viewsUnsigned variable vs null variable
I have the following codes: String str = null; and String str; If I use one if to check if the variables are null, if will be "called" in both cases. But is there any difference between the two…
-
2
votes1
answer117
viewsHow to change Java’s final property to C#?
Which property in C# corresponds to final Java, I need to change my variables final String mensagem = "Tokio Marine Seguradora S.A."; to something corresponding in C#. using System; namespace…
-
2
votes1
answer1039
viewsSort list by a string property with number
I have an object of the type Ata where I own the property NroAta which corresponds to the number of the minutes in question, but in grid when I sort by this number, it ends up putting the numbers in…
-
2
votes1
answer79
viewsNull attribute check in @Html.Displaynamefor
I need to check if the attribute of a class is null. If it is null, I would like to hide its label. Below is an example of how it is being displayed today: The attribute Dating null came, so it…
-
2
votes2
answers1450
viewsC#url shortener
I’m adjusting a code in c# for a url shortener api to send in the sms inside an application, it’s all working, but the out-of-code api works, but within the code the Return comes back nothing, I’m…
-
2
votes1
answer100
viewsPre-filled model returns null in Httppost
I’m building a page in the ASP.NET project where I have a model that contains 2 lists, which I fill one initially at get and then direct to the View where I fill another list, but when receiving…
-
2
votes2
answers7845
viewsHow to resolve "Could not create SSL/TLS Secure Channel." error?
In my project, I need to communicate with a Webservice and send data to it. However when I do the envelopment and sent, it shows the following error: "Could not create SSL/TLS Secure Channel.".…
-
2
votes1
answer352
viewsEntityframework does not recognize Config Web transformation
In my solution C#, I use transformation Web.config to connect a specific data environment, but I’m having a problem with EntityFramework who can’t recognize string de conexão transformed, only…
-
2
votes2
answers379
viewsERROR - Catch Xelement C#
Hello. I’m trying to get a Node of an xml Nfe can this appearing image error. At the beginning of the class a variable was created private XDocument xDoc; The xml file is inside the debug folder.…
-
2
votes1
answer144
viewsSkyrim style item system
I am developing a 2D RPG in C# Skyrim style, and I am on the part of implementing the game items, but with many difficulties. I wanted to do a mechanics similar to Skyrim in which you have a range…
-
2
votes2
answers691
viewsHow do I send an email without sending an attachment?
Hello, I have a question: I made a script to send email, but I would like that when sending it the user does not necessarily need to put an attachment (ie leave the sending of the attachment not…
-
2
votes1
answer1015
viewsHow to check user on login screen?
I have a problem, I have a login screen and I need to check it with a query Sql. To be able to do something, but she doesn’t check and enter directly. private void btn_Entrar_Click(object sender,…
-
2
votes1
answer1940
viewsHow to resize an image in c#?
I’m working on an application that uploads images. It turns out that the customer sometimes sends these images with a very large resolution, which is not necessary in our case (reaching 7MB). I need…
-
2
votes1
answer88
viewsConversion from Hex to Decimal using Two Add-on
I need to convert a string HEX for decimal, to string uses the Complement of Two standard and IEEE-754 to define the number of decimal places It is a tracking system, according to the manual to…
-
2
votes2
answers85
viewsModeling of Models 1 to n
I’m modeling a system for academies. I created 2 models, Modality public class Modalidade { [Key] public int ModalidadeId { get; set; } [MaxLength(200)] public string Nome { get; set; }…
-
2
votes2
answers67
viewsWhat is the best performance in comparison of string sizes?
What is the best performance option? And memory allocation? Using option 1 or 2? String text = "ola mundo"; Option 1: If ( Strings.len(text) > 0 ) {} Option 2: If ( text != "") {}…
-
2
votes1
answer31
viewsGet/Calular edges of a 3D object
I have the following question regarding obtaining the positions of a certain edge of a 3D object. Example, I have a track (car game) and I want to calculate, through a script C#, both sides of the…
-
2
votes2
answers252
viewsTimer telling you when it’s over
How can I make the timer tell you when it’s running out on the console? It cleans the console every 1 hour Example: > Falta 3 segundos para o terminar > Falta 2 segundos para o terminar >…
c#asked 6 years, 6 months ago user92401 -
2
votes2
answers5112
viewsWhat is a Dataset and what is its function?
Creating my first database applications (SQL Server), I connect by passing my string and using the Sqlcommand class to pass the query. But searching other sites, I see that access to the bank is…
-
2
votes1
answer1458
viewsProduct is a namespace but is used as a type
I have this error message: Product is a namespace but is used as a type It was working and when I arrived to compile, I’m picking up this error. How do I fix this?…
-
2
votes1
answer624
viewsHow to truncate text without cutting words . NET?
I’ve been trying so many ways for days but I haven’t been able to do this script take the value of <h3> and return the text to it truncated. Javascript: <script type="text/javascript">…
-
2
votes1
answer507
viewsredirecting C#/javascript pages
I am with a question a little bit silly ( I think ), I have to make a filter for customer and need to do urgent, so I gave a "quick" solution to my problem, created a controler that does customer…
-
2
votes1
answer531
viewsHow to save Image to a specific folder?
I have the following code: protected void btnSalvarDestaque_Click(object sender, EventArgs e) { if (fuFotos.HasFile) { string strname = fuFotos.FileName;…
-
2
votes1
answer499
viewsHow to print a double with 4 houses after the dot in C#?
static void Main(string[] args) { double area, raio , pi; pi = 3.14159; raio = Convert.ToDouble(Console.ReadLine()); area = pi * Math.Pow(raio,2); Console.WriteLine("A={0}\n",area.ToString("N0")); }…
-
2
votes1
answer96
viewsHow to read one struct inside another with Json.Net?
I need the program to read this information: {"kiseryota":{"id":15031780,"name":"Kise Ryota","profileIconId":1374,"summonerLevel":30,"revisionDate":1475089675000}} Here’s what I’m doing: Structure:…
-
2
votes1
answer255
viewsAdd the same column by different criteria?
I’m trying to create a report using ReportViewer that makes a SUM in the same column for different criteria. My query works well in Phpmyadmin but in Querybuilder of Reportviewer does not work and…
-
2
votes0
answers84
viewsDotnet running error on Mac
Good evening, I did the installation of . Net Core as per instructions: https://www.microsoft.com/net/core#macos I created the project directory and when I will run (via terminal), as per command:…
-
2
votes2
answers100
viewsSRP- Principle of Single Liability
In the Order class, which contain the business rules for requesting a sales order, state which of the options below violates the principle of sole liability (SRP- Single Responsibility Principle)?…
-
2
votes3
answers1618
viewsEncoding string conversion
I have the following string Cinto De Segurança How do I convert her to be like Cinto De Segurança
-
2
votes2
answers487
viewsTake only the return value in a Dapper
A query returns this? var teste = _connection.Query(sQuery.ToString(), par).FirstOrDefault(); well, within the var test I have it: UF = "MA" but I just want the MA. How do I make Dapper return me…
-
2
votes1
answer879
viewsHttpcontext.Current.Session is null in thread
Hi, I have a problem with my code. I’m doing a function that lasts about 3/4 hours long, and then I decided to do this function in a thread so that it doesn’t block the overall functioning of the…
-
2
votes3
answers257
viewsShow property value instead of class name in Datagridview
I have a Datagridview that should show data between related tables and I can’t get it to show the data correctly, it shows the namespace name followed by the class name. I saw some things and showed…
-
2
votes1
answer593
viewsHow do function to encrypt password in C#?
How do function to encrypt password in C#? I want to take the password attribute and encrypt it. public String gravarCadastro(Cadastro cadastro) { string sql; int retorno; string resp; try {…
-
2
votes1
answer47
viewsMethod convert file to UTF-8
I have an Androiddecompress class that takes Androidmanifest.xml and transforms it into xml so it can be read, the problem that it only converts the file that is in Unicode of version 2 of…
c#asked 6 years, 6 months ago Diogo Soares 158 -
2
votes2
answers46
viewsHow to prevent a command
I would like to prevent my record from being saved if the radiobutton were not selected. My code: private void btnSalvar_Click(object sender, EventArgs e) { if ((rdbMasculino.Checked == false)…
-
2
votes0
answers243
viewsBeginform makes GET instead of POST
I have a controller that has two actions; public ActionResult Cadastrar() { return View(); } //[ValidateAntiForgeryToken] [HttpPost] public ActionResult Cadastrar(Usuario usuario) { if…
-
2
votes1
answer723
viewsUpdate in Database by c#
I’m trying to update my database by visual Studio(c#), but the update is not being carried out I don’t know why. Table script(sql developer): CREATE TABLE Login ( Cod_login NUMBER(8) NOT NULL,…
-
2
votes3
answers1074
viewsGet object content without knowing the attribute name
In Javascript I have, for example, the object: var meuCarro = { fabricacao: "Ford", modelo: "Mustang", ano: 1969 }; And to access his content, when I don’t know the attribute name, I can access it…
c#asked 6 years, 5 months ago user75204 -
2
votes1
answer1196
viewsRedirect to a controller in another Area
I looked for a solution to this but could not, I’m trying to redirect session errors to login, my application is inside a folder called Areas and when he saw something redirect to him I redirect so…
-
2
votes2
answers2085
viewsRadio button selection return in C#
Good morning. I have a Groupbox that contains 5 Radiobutton. I have a function where it receives the name of the Groupbox and it returns 1 if any Radiobutton is selected and -1 if no Radiobutton has…
-
2
votes3
answers3159
viewsAdd SOAP Header to SOAP C#
I’m trying to add a header customized in one service SOAP using C#. I’ve searched everything and I can’t find a solution that works. I’m adding the service by Web References of C#. I’ve tried to do…
-
2
votes1
answer251
viewsRound up minutes C#
Guys, I have a problem that is, I need to round up the minutes of an hour, for example: if the time is 12:28 I need it to turn 12:30, I always need to round it up, does anyone know how to fix this?…
-
2
votes2
answers860
viewsHow to create a report in Sql Server with information by date
I am created a system for output management, one of my tables stores the output history information, it has the following columns, IDpedido, DataDoPedido CodProduto, QuantidadeProduto CustoProduto…
-
2
votes0
answers41
viewsAsp.net with Github
I have some time of experience with versioning GITHUB with java, always worked efficiently between teams. I’m with an ASP.NET project based on Webforms, and I’m trying to get in touch with GITHUB. I…
-
2
votes1
answer172
viewsHow to load Tableview Dynamically
I’m having trouble creating a menu dynamically by loading directly from a list. In my project this is the following way <?xml version="1.0" encoding="utf-8" ?> <ContentPage…
-
2
votes1
answer44
viewsHow to add a span to an htmlhelper?
I have this helper <li>@Html.ActionLink("Registar", "Register", "Account", routeValues: null, htmlAttributes: new { id = "registerLink"})</li> I wanted to add this <span…
-
2
votes2
answers641
viewsCalculate more than one text box and display in a specific text box
Good morning, you guys, I’m racking my brain on how to proceed with such logic; I would like to take the value of these 4 textbox (txtDinheiro, txtCheque, txtCredito and txtDebito) and in the end go…
c#asked 6 years, 5 months ago Carlos Henrique 29