ogie1985
ogie1985
CC#
Created by ogie1985 on 4/6/2023 in #help
❔ Is it possible to create an desktop application with Blazor?
Basically title
72 replies
CC#
Created by ogie1985 on 3/8/2023 in #help
❔ Difference string and string?
string? t = null; // no warning string t2 = null; // warning Console.WriteLine(t); Console.WriteLine(t2); //behaves same
28 replies
CC#
Created by ogie1985 on 12/10/2022 in #help
❔ How to reverse engineer your simple console app code?
Just curious. Is this possible with programs like x64dbg or... ?
94 replies
CC#
Created by ogie1985 on 11/30/2022 in #help
❔ [Git] How to grab your pushed changes back
Maybe it's not home here but I'm curious how I could grab my pushed changes back because I need to make some cleaner commits
8 replies
CC#
Created by ogie1985 on 11/29/2022 in #help
❔ deserialize in csharp
is c# deserializer smart enough to deserialize the fields it only got or does your class have to match exactly the same ? Because I can sometimes get optional fields
11 replies
CC#
Created by ogie1985 on 10/29/2022 in #help
Best csharp and framework related books?
Not really a question specific about programming but... please write your recommended c# books below. I have some budget to spend on books and would like to make good use on it
1 replies
CC#
Created by ogie1985 on 10/3/2022 in #help
Filter and give back a new object with Linq
Simulating the current situation:
class MyDTO{
int Id {get;set;}
int IdOfSomethingElse{get;set;}
string Description {get;set;}
string Description2 {get;set;}
}
class MyDTO{
int Id {get;set;}
int IdOfSomethingElse{get;set;}
string Description {get;set;}
string Description2 {get;set;}
}
`
var myDTOList = new List<MyDTO>()
{
new MyDto{
Id = 1,
IdOfSomethingElse = 2,
Description = "blabla1",
Description2 = "blabla11"
},

new MyDto{
Id = 2,
IdOfSomethingElse = 2,
Description = "blabla2",
Description2 = "blabla22"
}


new MyDto{
Id = 2,
IdOfSomethingElse = 3,
Description = "blabla3",
Description2 = "blabla33"
},

new MyDto{
Id = 4,
IdOfSomethingElse = 3,
Description = "blabla4",
Description2 = "blabla44"
}
}

How can I transform myDTOList to a new object with linq to the following object:

class MyNewDTO{
int IdOfSomethingElse= 2
List<string> descriptionList = will contain description of idofsomethingelse
List<string> descriptionList2 = will contain description2 of idofsomething else

}
var myDTOList = new List<MyDTO>()
{
new MyDto{
Id = 1,
IdOfSomethingElse = 2,
Description = "blabla1",
Description2 = "blabla11"
},

new MyDto{
Id = 2,
IdOfSomethingElse = 2,
Description = "blabla2",
Description2 = "blabla22"
}


new MyDto{
Id = 2,
IdOfSomethingElse = 3,
Description = "blabla3",
Description2 = "blabla33"
},

new MyDto{
Id = 4,
IdOfSomethingElse = 3,
Description = "blabla4",
Description2 = "blabla44"
}
}

How can I transform myDTOList to a new object with linq to the following object:

class MyNewDTO{
int IdOfSomethingElse= 2
List<string> descriptionList = will contain description of idofsomethingelse
List<string> descriptionList2 = will contain description2 of idofsomething else

}
2 replies
CC#
Created by ogie1985 on 10/1/2022 in #help
Entityframework .Select vs Mapping method [Answered]
Is the following the same or has it performance difference?
var myList = await _dbContext.SomeList.Select(x => new myDTO{...}.ToListAsync();
var myList = await _dbContext.SomeList.Select(x => new myDTO{...}.ToListAsync();
var myData = await _dbContext.SomeList.ToListAsync();
var myList = MapToMyDTO(myData);
var myData = await _dbContext.SomeList.ToListAsync();
var myList = MapToMyDTO(myData);
7 replies