Questions tagged as 'c#'

1
answer

ActionResult or JsonResult returning Json?

I see a lot of code in Controller where it is used as method ActionResult returning Json() , but I also see an approach using method JsonResult logically returning Json . Are there any differences between thes...
asked by 19.04.2018 / 17:12
2
answers

Initializing Array of a new class

Considering two classes in C #: public class aClass { public string afield; } public class bClass { public aClass[] bfield; } I want to start the variable as bClass cVar = new bClass(); cVar.bfield[0].afield = "text"; but is g...
asked by 05.04.2018 / 21:40
2
answers

Problem with inheritance

I have a problem with a search in the bank, I will try to explain it in the best possible and clearest way. I have a Pessoa table and a Cliente table, the last one inherits from Pessoa , I also have a Unidade table a...
asked by 03.11.2016 / 13:11
2
answers

Generate txt file according to default layout in C #

I need to export data from a class according to a specific layout that consists of size and position. For easy maintenance, I need a simple layout change. Below is my class: public class NovosCotistasDTO { public string A...
asked by 16.07.2015 / 16:56
2
answers

Doubt regarding Security, Authentication and Authorization

Hello, I'm having trouble building an architecture in the security-related part of the application. I need only logged-in and authorized users to have access to certain application functions. I know that I would normally use Roles-based authoriz...
asked by 19.07.2015 / 01:33
2
answers

Filtering collection of children in Entity Framework with Lambda

I have a case where I need to bring all the items of the parent object where it has a certain condition, for example: ctx.Pai .Where(x=> x.Ativo == true) .Include(Filhos) .Where(TrazerApenasFilhosAtivos); I've tried using Any...
asked by 17.07.2015 / 13:06
2
answers

Return the path value

How to return the value with the name of a folder in C #? Example, if I execute: Directory.GetFiles("%PROGRAMFILES% (x86)\MyApp", "*.*", true); And if you can do it, it returns like this: %PROGRAMFILES% (x86)\MyApp\MyApp.exe %PROGRAMFI...
asked by 27.09.2015 / 17:41
1
answer

GetEnumerator Error When Rendering a View

I did this just as a test: @model Operador.MVC.Models.OperadorModel @{ ViewBag.Title = "Operador"; } <table id="tblOperador" class="table table-hover table-striped" border="1" cellspacing="0" style="width: 100%;"> <thead>...
asked by 08.10.2015 / 18:29
1
answer

Destroying an instance

How do I destroy an instance? I have an object whose instance is referenced in various parts of my code. At some point I need to delete this object and for this I am doing the following: meuObjeto = null; The problem is that this code is...
asked by 27.10.2015 / 01:05
2
answers

How to do the where ands of where dynamically with linq and Entity Framework?

How can I make ands dynamically in where using Linq and entityFramework? Thank you in advance for any help. return _dbContext.TbParceiro //Preciso fazer algo do tipo mas isso não funciona, não sei como posso fa...
asked by 12.12.2017 / 18:33