Questions tagged as 'c#'

1
answer

c # - Unity - Error: Object reference not set to an instance of an object

I'm a beginner in C # programming, and I'm trying to learn how to make a sidescroller 2d game, but I could not get past a part of the tutorial. This is because the camera simply does not follow the character when I press play and Unity shows an...
asked by 29.05.2016 / 06:49
1
answer

Generic method in DbSet of DbContext with Entity Framework

I have an application in C# that uses Entity Framework . All my DbSet of DbContext , I extend them to have a default search for the grid, below method example. public static GridDTO GridPadrao(this DbSet<Cliente...
asked by 17.06.2016 / 13:31
1
answer

Linq groups and fetches the max id

Is there any way to optimize the code below so that you search for the forms that are at the maximum version according to IdCentroCusto ? In the code below I'm doing the grouping and getting the CM.Max(d => d.Versao) to fetch...
asked by 07.12.2015 / 18:52
3
answers

Scaffolding error during View generation

I'm creating a new project using EF Power Tools and I get the following error:    Error   There was an error running the selected code generator:   'A configuration for type' TST2.Models.Course 'has already been added.   To reference the ex...
asked by 24.11.2015 / 12:53
2
answers

How to check the name of the Excel C #

How to check the name of the "Sheet" of the Excel worksheet before performing the% pro SQL ? My code so far: protected void btnProcessar_Click(object sender, EventArgs e) { string path = Server.MapPath(".") + "\" + FileUp...
asked by 15.08.2016 / 18:32
1
answer

Variable with unassigned value within a FOR Loop

int i; string cpf; cpf = "11111111111"; DbConnection cnx = ADO_Utils.GetConnection(); DbCommand cmd = ADO_Utils.GetComando(cnx); cmd.CommandType = CommandType.Text; for (i = 1; i < Convert.ToInt32(txbQtde.Text); i++...
asked by 21.04.2016 / 03:59
2
answers

Convert Switch to IF

Hello everyone is this I have this code and I needed to change it to if instead of switch , how can I do this? switch (theOperator) { case "+": total2 = total1 + double.Parse(total3.ToString()); break;...
asked by 03.08.2016 / 11:50
2
answers

ViaCEP does not populate user address data (Website on .NET platform)

I'm developing a web application on the .NET platform and thought of having the user type the zip of their address and automatically populate the textboxes with street, neighborhood, city, and state data. But in my code it does not work, I do no...
asked by 17.05.2016 / 01:46
1
answer

Decimal places c #

I have a variable of decimal type returning me the value 270.61864847349717630804948048 how do I return with only 3 houses after the comma, in case I pass 270.618 only. Thank you in advance     
asked by 12.04.2018 / 20:41
1
answer

Conversion of Java code to C #

I would like a help to convert the following code in Java to C #. public static long convertStringToBitboard(String Binary) { if (Binary.charAt(0)=='0') { return Long.parseLong(Binary, 2); } else { return Lon...
asked by 19.04.2018 / 23:50