Questions tagged as 'c#'

2
answers

Expression-bodied is recommended? Does it have performance differences?

To what extent is it recommended, or even good practice, to use expression-bodied ? I know that expression-bodied allow properties, methods, operators, and other function members to have bodies defined using lambda expressions ( =>...
asked by 20.08.2018 / 20:33
3
answers

Angular + ASP.NET MVC: Makes sense?

I'm starting to study Angular2. As I'm working a lot with .NET I've decided to do a project with ASP.NET MVC 4 and Angular2. Reading the hello world of the Angular I noticed that the Angular has its own route mechanism, which would in a w...
asked by 10.02.2017 / 03:20
2
answers

Is it possible to work directly with EntityFramework sources?

Is it possible to work directly with Entity Framework and debug sources within your classes and methods? > I downloaded the zip code from it contained in CodePlex . I unpacked it into a folder and in my project I added the project dire...
asked by 27.08.2014 / 23:07
2
answers

ASP.NET Core IsDevelopment

When creating a project with dotnet cli / em>    dotnet new razor -o RazorPagesContacts How do I change the environment variable to developer mode when running the application using dotnet run . Since no Startup.cs I h...
asked by 20.12.2017 / 16:15
2
answers

Doubt - SaveChanges does not work, only returns 0

Follow the code below: using (var db = new Entities()) { var result = db. Tabela1 .Where(x => x.Id == 1) .Select(x => new SuaClasse { Coluna1 = x.Coluna1, }) .FirstOrDefault...
asked by 30.10.2017 / 23:45
2
answers

Return xml to asp.net mvc browser view

I have the following situation, I need to make an XML file available to be viewed in browser , without the user having to download the file, I do this by saving the file in a directory and then I send the directory of this file and the browse...
asked by 10.04.2017 / 22:25
2
answers

Saving the same file at the same time on different threads

In my software I have a thread that every second updates the file X. This same file can also be updated through a user action that will be in another thread (can be any time). My question is: what will happen if both threads...
asked by 04.05.2018 / 15:52
2
answers

Prevent an application from being closed by the user through the task manager

I have a C # application that can not be closed by the user. But even if I eliminate all means of closing the application, including by itself, it is still possible to terminate the process by the task manager. Can you stop this? Is it possible...
asked by 24.02.2015 / 14:28
2
answers

Wrong date calculation

I have the following method: TimeSpan dt = dataFinal.Subtract(dataInicial); double anos = Math.Floor(dt.Days / 365.25); double meses = Math.Floor(((dt.Days - anos * 365.25) / 30)); return string.Format("{0} Anos e {1} mês(es)", anos, meses);...
asked by 11.03.2015 / 15:38
2
answers

How to generate a file in the same exe directory

I am generating an XML file and I want it to be generated by the exe. XmlTextWriter writer = new XmlTextWriter(@"c:\dados\filmes.xml", null); instead of per directory to save to the exe.     
asked by 10.10.2014 / 18:30