Questions tagged as 'c#'

3
answers

Update generating duplicate key error

I have a web application in .net 4.5.1 with MVC and entity framework. The error occurs in a basic CRUD. I retrieve the object that will be the model sent to the view with the following code: Professor professor = db.Pessoa .I...
asked by 03.02.2014 / 22:15
1
answer

Letter after a number, what is this called?

What's the name of it? double d1 = 0d; decimal d2 = 0L; float d3 = 0f; And where can I find a character reference that I can use? If I want to do a cast from 0 to short , is there any letter for this?     
asked by 22.12.2013 / 01:46
2
answers

How to redirect from non-www to www?

I want visitors to my site to always access with www . I want to somehow redirect in case the user tries to log in without www or subdomain. If you try to access exemplo.com I want to redirect to www.exemplo.com ....
asked by 11.12.2013 / 23:17
2
answers

Check if the previous day is a holiday and / or Sunday

I'm having trouble developing a date validation logic. The variable dataFecha is called with -1 day to already validate the previous day. But when I test the validations, he did not subtract (-1) day in the variable, to validate the Sa...
asked by 13.12.2017 / 12:43
2
answers

Where to create a Helpers layer?

I need to create a Helpers layer that will contain classes that will be made available for the entire project. These classes will contain functions like calculations, string cleaners, in short, those functions we use all the time ......
asked by 28.02.2018 / 10:59
1
answer

What is ADO.Net for C #?

I'm starting to learn about C # for Web applications, and wanted to know what is ADO.Net and what are the advantages of using it?     
asked by 04.10.2015 / 17:25
2
answers

How to convert ASCII to binary?

I am trying to implement the conversion of a text to binary, I found one through the internet: static string ASCII_binary(string texto) { string converted = string.Empty; byte[] byteArray = Encoding.ASCII.GetByt...
asked by 30.11.2015 / 13:25
1
answer

In a console program in C #, where is the main class defined?

I'm doing my first console program in C #, just to do some testing. I have two classes: HelloConsole.MainClass and HelloConsole.Calc . I have the following code: using System; // Aprendendo o alias de namespace using C = S...
asked by 14.06.2016 / 18:37
1
answer

How to use multiple models in a view

I am doing an individual registration and I have the following models: Pessoa Fisica Juridica In my view code, I only have the declaration of a model : @model CodeFirst.Models.Fisica The problem is that whe...
asked by 23.11.2015 / 11:59
2
answers

list.foreach vs foreach

I have a list with several string , there is a difference between scrolling the list values: This way: ListaString.ForEach(delegate(string str) { Console.WriteLine(str); }); Or this: foreach(string str in ListaString) { C...
asked by 06.08.2015 / 14:01