Click here to Skip to main content
15,885,777 members
Home / Discussions / C#
   

C#

 
AnswerRe: can't catch task exception with C# Pin
Member 142229339-Apr-19 18:07
Member 142229339-Apr-19 18:07 
AnswerRe: can't catch task exception with C# Pin
OriginalGriff9-Apr-19 20:05
mveOriginalGriff9-Apr-19 20:05 
AnswerRe: can't catch task exception with C# Pin
Nathan Minier10-Apr-19 2:13
professionalNathan Minier10-Apr-19 2:13 
AnswerRe: can't catch task exception with C# Pin
Richard Deeming15-Apr-19 8:11
mveRichard Deeming15-Apr-19 8:11 
QuestionCompare Two Complex List of data Pin
V Krishna9-Apr-19 16:07
V Krishna9-Apr-19 16:07 
AnswerRe: Compare Two Complex List of data Pin
Gerry Schmitz10-Apr-19 6:55
mveGerry Schmitz10-Apr-19 6:55 
QuestionRe: Compare Two Complex List of data Pin
Maciej Los10-Apr-19 10:27
mveMaciej Los10-Apr-19 10:27 
QuestionHow to update my list1 property value by list2 property value by joining Pin
Mou_kol9-Apr-19 9:42
Mou_kol9-Apr-19 9:42 
C#
var list1 = new List<ItemOne>
                        {
                            new ItemOne {IDItem = 1, OneProperty = "1"},
                            new ItemOne {IDItem = 2, OneProperty = null},
                            new ItemOne {IDItem = 3, OneProperty = "3"},
                            new ItemOne {IDItem = 4, OneProperty = "4"}
                        };
            var list2 = new List<ItemTwo>
                        {
                            new ItemTwo {IDItem = 2, TwoProperty = "2"},
                            new ItemTwo {IDItem = 3, TwoProperty = "3"},
                        };


            var query = list1.Join(list2, l1 => l1.IDItem, l2 => l2.IDItem, (l1, l2) =>
            {
                l1.OneProperty = l2.TwoProperty;
                return l1;
            });


see the above code where two list join and updating first list's one property called OneProperty by second list property called TwoProperty

how to do the same with LINQ normal syntax ? like below onevar data = (from a in list1
C#
join b in list2
                       on a.IDItem equals b.IDItem into c
                       from d in c.DefaultIfEmpty()
                       select new
                       {
                           a.OneProperty=(d==null ? string.Empty : d.TwoProperty)
                       }).ToList();


in the above code i have not used JOIN function rather use join keyword. now tell how to customize my above code to update one property value of list1 by another property value from list2.

please share code or customize my code to work. thanks
AnswerRe: How to update my list1 property value by list2 property value by joining Pin
Eddy Vluggen10-Apr-19 0:21
professionalEddy Vluggen10-Apr-19 0:21 
QuestionHow to equi join and left join between 3 List<t> Pin
Mou_kol9-Apr-19 9:41
Mou_kol9-Apr-19 9:41 
QuestionApplication Server and Connection Method Pin
mikiz8-Apr-19 21:30
mikiz8-Apr-19 21:30 
AnswerRe: Application Server and Connection Method Pin
Pete O'Hanlon9-Apr-19 1:22
mvePete O'Hanlon9-Apr-19 1:22 
AnswerRe: Application Server and Connection Method Pin
Eddy Vluggen9-Apr-19 1:53
professionalEddy Vluggen9-Apr-19 1:53 
GeneralRe: Application Server and Connection Method Pin
mikiz9-Apr-19 4:13
mikiz9-Apr-19 4:13 
GeneralRe: Application Server and Connection Method Pin
Dave Kreskowiak9-Apr-19 4:36
mveDave Kreskowiak9-Apr-19 4:36 
GeneralRe: Application Server and Connection Method Pin
Eddy Vluggen9-Apr-19 5:48
professionalEddy Vluggen9-Apr-19 5:48 
AnswerRe: Application Server and Connection Method Pin
Dave Kreskowiak9-Apr-19 3:05
mveDave Kreskowiak9-Apr-19 3:05 
GeneralRe: Application Server and Connection Method Pin
mikiz9-Apr-19 4:02
mikiz9-Apr-19 4:02 
GeneralRe: Application Server and Connection Method Pin
Eddy Vluggen9-Apr-19 8:56
professionalEddy Vluggen9-Apr-19 8:56 
GeneralRe: Application Server and Connection Method Pin
Dave Kreskowiak9-Apr-19 9:22
mveDave Kreskowiak9-Apr-19 9:22 
GeneralRe: Application Server and Connection Method Pin
Eddy Vluggen9-Apr-19 9:28
professionalEddy Vluggen9-Apr-19 9:28 
AnswerRe: Application Server and Connection Method Pin
Gerry Schmitz9-Apr-19 5:58
mveGerry Schmitz9-Apr-19 5:58 
AnswerRe: Application Server and Connection Method Pin
Mycroft Holmes9-Apr-19 12:29
professionalMycroft Holmes9-Apr-19 12:29 
QuestionIPV6 Compatibility Pin
chain singh aanjana7-Apr-19 20:37
chain singh aanjana7-Apr-19 20:37 
AnswerRe: IPV6 Compatibility Pin
Gerry Schmitz8-Apr-19 5:47
mveGerry Schmitz8-Apr-19 5:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.