Questions tagged as 'c#'

2
answers

Save values in Hashtable

When I save the value of this Hastable it gives me error. Follow the code: Hashtable ht = new Hashtable(); ht.Add("index", index); ht.Add("tipo", "1"); string tipo = ht["tipo"];     
asked by 09.06.2016 / 16:58
3
answers

How and where to implement business rules in the Entity Framework?

I have the following example of a software that uses the Entity Framework , which accesses a database with only one table named Produtos with the following fields: Field int produtoid . Field string nomeproduto . Field...
asked by 20.05.2016 / 01:22
2
answers

Login with Windows Authentication in IIS

I have a SqlServer 2008 base where all users can connect to it via Windows domain, this works correctly via SQL Management Studio. I'm doing a C # Application in MVC, and wanted it when the user accessed the site, I could get that login and p...
asked by 03.05.2016 / 14:17
3
answers

How to transform a date into a string format with no signs in DateTime?

Examples: string data = "08072013"; string hora = "1515"; Is there a specific method for this type of format? I tried to use Convert.ToDateTime() , DateTime.Parse , etc. and everyone returned an exception. I'm currently doing th...
asked by 01.07.2014 / 22:43
2
answers

Is there a difference in how the polymorphism in Java and C # is applied?

I'm studying the concepts of OOP and it gave me a question. In Java I believe I can access all methods and attributes declared as public in a subclass even when I use a superclass type variable to reference this subclass. But in C # I can...
asked by 31.05.2017 / 19:09
2
answers

Clause in with lambda

Is it possible to have an IN clause with lambda expression? Type: context.tabela.Where(a => a.meu_campo_id_tipo_inteiro....) let's say an in like this: (2,3,4,5) How do I put on the dots?     
asked by 02.06.2014 / 17:41
2
answers

How do I get properties of a type when I use Generics C #

I have the following class: public class Pessoa { public int id { get; set; } public string Nome { get; set; } public DateTime DataNascimento { get; set; } } I've developed a method to get the properties of it, but I can not use...
asked by 11.05.2017 / 16:32
2
answers

How to exit a cycle in C #?

I need to exit foreach when the value is equal to 1 foreach (DataGridViewRow dr in dgvValetes) if(dr.Cells["valor"].toString()=="1") //Sair aqui I do not know how to do ...     
asked by 16.06.2016 / 12:36
2
answers

Difference between ADO.NET and Dapper

What are the differences between the ORM's? When to use one and when to use the other? What are the disadvantages of each?     
asked by 19.07.2018 / 02:32
5
answers

Change return / Date (1386295200000) / to date format

I have a return of json that comes from SqlServer : /Date(1386295200000)/ How to convert to date format dd/mm/yyyy ?     
asked by 22.03.2018 / 20:12