Questions tagged as 'c#'

3
answers

How to simplify this comparison?

I often fall into the following situation: For example in C #: string variavel= "x"; boolean b = (variavel == "a" || variavel == "d" ||.....|| variavel== "y");    Is there any way to simplify something like b = ("a" || "b" ||   .... "an...
asked by 28.01.2016 / 18:47
2
answers

EF 6, Mapping with Fluent Api in classes with inheritance

I am training the class mapping for the Entity Framework using the Fluent API and I have some questions. The first is this: Mapping a foreign key with attributes would look like this: public int EmpresaId {get; set;} [ForeignKey("EmpresaI...
asked by 19.03.2014 / 15:56
1
answer

Is it possible for a program to modify its own code?

I was developing an artificial intelligence program with neural networks, but what always made me embarrassed is that every time I open the program, it will have to repeat the whole course of learning to achieve the same result as before. My...
asked by 08.07.2017 / 23:33
2
answers

Change of object in inheritance

I have the following classes: class Funcionario { } class Coordenador : Funcionario { } class Gerente : Funcionario { } At that point a Coordinator can become a Manager. How to solve this?     
asked by 22.03.2017 / 15:42
3
answers

How to filter an IEnumerable type list through another IEnumerable?

How to filter a list type IEnumerable<> by passing a parameter of type IEnumerable<> preferably via expression lambda or linq ? Based on the filter below, I expect this result: {MundoId = 0, Continente...
asked by 01.06.2017 / 13:28
3
answers

Is it correct in a DTO class to have attributes of two or more tables?

I need to return on a REST data from two tables, to be consumed in an Android / IOS App, developed with xamarin. As I return a DTO, I found it good to bring data from two tables in this DTO, but I find it somewhat gambi. The other solution would...
asked by 31.08.2017 / 13:56
2
answers

Know if the application was terminated by the task manager

Is my application aware that it is being terminated by the task manager? If the user is to terminate my application through the task manager, does my application detect this completion and perform some tasks before it is finished? Does any...
asked by 08.07.2015 / 18:30
2
answers

StreamWriter Class

My idea is to create a system to insert new employees through the CadastrarFuncionario() method, putting the properties of the class ( ID, nome, CPF ) inside a file named officials.txt. With the logic used by me, the values are i...
asked by 02.08.2017 / 15:40
3
answers

Is it possible to back up a remote bd sql server via C #?

I am using the Microsoft.SqlServer.Management.Smo assembly to back up a Sql Server database in C #. The problem is that in the way it is implemented I can only perform the action if I am running the application on the same database server. Wo...
asked by 14.04.2015 / 14:41
1
answer

How to find the term X of the Fibonacci sequence?

I have to make a program in C # that receives a% number of% that will be the term of the sequence and print it on the screen.     
asked by 16.03.2015 / 00:23