Questions tagged as 'c#'

3
answers

How to do an "insert" with Dapper using a class?

I'm testing Dapper and when I try to use a class I found the error:   Must declare the scalar variable Follow the code: public class Teste { public int id; public string nome; public int idade; } using (IDbConnectio...
asked by 02.10.2017 / 18:20
2
answers

What is the best place to store the connection string? [closed]

There are a few possible places to store the string connection. Leave tied inside code, app.config , configuration file and Windows registry. What is the best place to store the string connection? Based on the requirements, security...
asked by 02.06.2016 / 15:41
3
answers

How to convert from Text to Number via code to EXCEL in C #

I have a program that reads data from a text file and exports it to an excel report. I have a problem with transcription of numbers, in the txt file I have data in this format: 8,000000 This value should be regarded as 8 (number) by the...
asked by 03.06.2016 / 19:56
1
answer

Upload file via POST to WebAPI

I need to upload a file to WebAPI , I'm using the following code to upload public void Enviar() { WebRequest request = WebRequest.Create(url); request.Method = "POST"; byte[] byteArray = File.ReadAllBytes(fileName); re...
asked by 16.09.2016 / 14:17
1
answer

What is the difference between Ajax.BeginForm and Html.BeginForm in Asp.net MVC

Working with web in asp.net mvc , I saw that it is possible to use Ajax.BeginForm() and Html.BeginForm() . What is the difference between Ajax and Html ?     
asked by 08.07.2016 / 23:38
1
answer

Foreign key can be null in Entity?

I'm having a hard time on a project. I have created two tables ( Union and School ), with% of the Union table being PK in the School . But this FK can be null, meaning the School can belong to a Union or not. Well, here's...
asked by 30.07.2015 / 16:59
1
answer

What are the pros and cons of the TaskListObject implementation on ListObject

What are the advantages between the two implementations below. Both return a list with several products (more than 1k): public Task<List<Product>> GetAllProductsAsync() { var query = Products.ToList(); return Task.FromResu...
asked by 01.08.2015 / 16:26
3
answers

IFs and Object Orientation - C #

I have a question about how to replace IF with polymorphism. I'll give you the following example: Let's say I have the ExecucaoIndividual and ExecucaoGeral classes. For this I created an interface to use the strategy pat...
asked by 26.06.2015 / 17:28
1
answer

How to use bytes from BitConverter.ToDouble

I have an interface that sends a reference value to a microcontroller. I need to send the values in bytes because these values will be stored in the memory of the microcontroller. In the interface, in C # I'm using for example: double referenc...
asked by 14.10.2015 / 21:14
1
answer

Problem with Nuget Packages Visual Studio

Trying to compile the application, I come across the error:    Severity Code Description Project File Line Suppression State   Error This project references NuGet package (s) that are missing on   this computer. Use NuGet Package Restore to d...
asked by 15.02.2017 / 18:22