Questions tagged as 'c#'

3
answers

Is the connection to the bank open in static mode?

I have the following static class available for the entire application: public static class MinhaClasse { public static void Salvar(Item meuItem) { using (MeuEntities db = new MeuEntities()) { db.Item.Add(meuItem...
asked by 23.09.2015 / 22:44
4
answers

Is it possible for a JavaScript function to call a method that is in the code behind the page?

I have a button and I wanted to program click of it, and when I use <asp:Button> I program click of it in code behind . I'm now using a button normal. I know almost nothing about JavaScript and wanted to pro...
asked by 11.09.2015 / 20:51
4
answers

Access javascript variable in loop with model

I'm creating an Asp.Net MVC project and found a problem in View. See the code: <script> var data = []; for (var i = 0; i < '@(Model.Count())'; i++) { data[i] = { "source": '@(Model.ElementAtOrDefault(0).Source)',...
asked by 09.04.2015 / 13:56
1
answer

Questions in Windows Forms and C #

I'm trying to learn C # but I'm having a hard time understanding the file and folder hierarchy of Visual Studio 2013 Solution Explorer. I can not understand why there are two .cs files, one for the design and another for the program itse...
asked by 23.06.2015 / 21:10
1
answer

What is the purpose of the Uri class?

What is the Uri class and what is its purpose and where should I use it? Can not pass an object from it to a string variable see in the example: String caminho = new Uri(@"c:\Windows"); Generate the following error:    Error 1...
asked by 10.03.2016 / 01:30
2
answers

How to change the way in which a class / structure is printed?

I have the following structure: struct cores { int r, g, b; public cores(int r, int g, int b) { this.r = r; this.g = g; this.b = b; } } If I have a new structure printed, it looks like this: Consol...
asked by 10.09.2017 / 03:05
2
answers

Windows Forms Application - Visual Studio 2017

I realized that I do not have the choice of a project in Windows Form Application in Visual Studio 2017. I looked, and saw that there is a possibility of selecting the option during the installation. Once Visual Studio has been inst...
asked by 03.10.2017 / 04:33
3
answers

How can I use or name constants for response type fields?

There are situations in which we have fields that represent a type of response, whether they are boolean sim and não , S and N or with multiple answers like the status of something. For example the status of a course c...
asked by 09.07.2018 / 19:38
2
answers

Failed to display fields of the Address class when using object-creation method expressed in C #

Visual Studio 2017 suggested something that surprised me, creating an object without using the new operator, I was surprised because I'm coming from Java and it's been a year since I was stopped and I decided to go back to school. Well, when...
asked by 11.05.2018 / 12:32
2
answers

Is it correct in MVC to access data within the model?

In a C # MVC project, is it okay to access data within the model ? For example: public class Cliente { public int Id { get; set; } public string Nome { get; set; } //outros atributos... public void Inserir(){ Client...
asked by 26.10.2017 / 16:16