C# List: How to do 3 joins for higher performance?How to refactor these C#-events or fix this...

Is it legal to have the "// (c) 2019 John Smith" header in all files when there are hundreds of contributors?

Why doesn't a const reference extend the life of a temporary object passed via a function?

Where to refill my bottle in India?

Re-submission of rejected manuscript without informing co-authors

Doomsday-clock for my fantasy planet

What are the advantages and disadvantages of running one shots compared to campaigns?

Can the Produce Flame cantrip be used to grapple, or as an unarmed strike, in the right circumstances?

What happens when a metallic dragon and a chromatic dragon mate?

New order #4: World

extract characters between two commas?

Why do UK politicians seemingly ignore opinion polls on Brexit?

A poker game description that does not feel gimmicky

Denied boarding due to overcrowding, Sparpreis ticket. What are my rights?

What do you call something that goes against the spirit of the law, but is legal when interpreting the law to the letter?

Why is my log file so massive? 22gb. I am running log backups

Ideas for 3rd eye abilities

How to deal with fear of taking dependencies

Is Social Media Science Fiction?

Finding files for which a command fails

How did the USSR manage to innovate in an environment characterized by government censorship and high bureaucracy?

What does 'script /dev/null' do?

Where else does the Shulchan Aruch quote an authority by name?

Information to fellow intern about hiring?

What is the offset in a seaplane's hull?



C# List: How to do 3 joins for higher performance?


How to refactor these C#-events or fix this architecture?Optimizing List<string> performanceHow to optimize these nested loops for better performance?Any performance difficulties related to List<Type>?Multi threading in ASP.Net to increase performance of processing data from entity framework using anonymous typesImproving performance in a Webdriver methodHigher performance reading shorts from binary fileHackerrank - value of friendship (II)Optimize mySQL queryRepeated join in for loop






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







-1












$begingroup$


See my code:



var cfToggleList = (from cf in QCHelperall
join toggle in ToggleDataAll
on new { val = cf.Section.Trim().ToUpper(),
val1 = cf.Li.Trim().ToUpper(),
val2 = cf.Period.Replace("A", "").Replace("E", "").Trim().ToUpper(),
val3 = cf.Broker.Trim().ToUpper() }

equals new { val = toggle.Section.Trim().ToUpper(),
val1 = toggle.Lineitem.Trim().ToUpper(),
val2 = toggle.Period.Trim().ToUpper(),
val3 = toggle.Broker.Trim().ToUpper() }

into tempJoin
from leftJoin in tempJoin.DefaultIfEmpty()
select new QCHelper()
{
Broker = cf.Broker,
BrokerName = (from brk in BrokerCodeName
where brk.BrokerCode.ToUpper() == cf.Broker.Split('-')[0].ToUpper()
select brk.BrokerName).FirstOrDefault(),
Section = cf.Section,
Li = cf.Li,
StandardDate = cf.Period,
Value = cf.Value,
FycheckToggle = leftJoin == null ? string.Empty : (leftJoin.ToggleText.Contains("FYCHECKTOGGLE") ? leftJoin.ToggleText : string.Empty),
QcCheckToggle = leftJoin == null ? string.Empty : (leftJoin.ToggleText.Contains("QCCHECKTOGGLE") ? leftJoin.ToggleText : string.Empty)
}).ToList<QCHelper>();


There is a left join between two lists, called QCHelperall & ToggleDataAll and for each iteration, I am fetching data from another list based on match:



    BrokerName = (from brk in BrokerCodeName
where brk.BrokerCode.ToUpper() == cf.Broker.Split('-')[0].ToUpper()
select brk.BrokerName).FirstOrDefault(),


Can I join BrokerCodeName with QCHelperall list with equi join. If possible, then please review and give me recommendation as to where one left join could be between QCHelperall & ToggleDataAll and one equi join between BrokerCodeName with QCHelperall in the same place.



Can you review this code for performance and best coding practices?










share|improve this question









New contributor




user197025 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







$endgroup$












  • $begingroup$
    how to equi join BrokerCodeName & QCHelperall in above join? if i could join then performance will be better? now i am finding data in BrokerCodeName list for each iteration....does it kill the performance ? please some one answer & guide me.
    $endgroup$
    – user197025
    yesterday






  • 1




    $begingroup$
    The current question title, which states your concerns about the code, is too general to be useful here. The site standard is for the title to simply state the task accomplished by the code. Please see How to Ask for examples, and revise the title accordingly.
    $endgroup$
    – Jamal
    23 hours ago


















-1












$begingroup$


See my code:



var cfToggleList = (from cf in QCHelperall
join toggle in ToggleDataAll
on new { val = cf.Section.Trim().ToUpper(),
val1 = cf.Li.Trim().ToUpper(),
val2 = cf.Period.Replace("A", "").Replace("E", "").Trim().ToUpper(),
val3 = cf.Broker.Trim().ToUpper() }

equals new { val = toggle.Section.Trim().ToUpper(),
val1 = toggle.Lineitem.Trim().ToUpper(),
val2 = toggle.Period.Trim().ToUpper(),
val3 = toggle.Broker.Trim().ToUpper() }

into tempJoin
from leftJoin in tempJoin.DefaultIfEmpty()
select new QCHelper()
{
Broker = cf.Broker,
BrokerName = (from brk in BrokerCodeName
where brk.BrokerCode.ToUpper() == cf.Broker.Split('-')[0].ToUpper()
select brk.BrokerName).FirstOrDefault(),
Section = cf.Section,
Li = cf.Li,
StandardDate = cf.Period,
Value = cf.Value,
FycheckToggle = leftJoin == null ? string.Empty : (leftJoin.ToggleText.Contains("FYCHECKTOGGLE") ? leftJoin.ToggleText : string.Empty),
QcCheckToggle = leftJoin == null ? string.Empty : (leftJoin.ToggleText.Contains("QCCHECKTOGGLE") ? leftJoin.ToggleText : string.Empty)
}).ToList<QCHelper>();


There is a left join between two lists, called QCHelperall & ToggleDataAll and for each iteration, I am fetching data from another list based on match:



    BrokerName = (from brk in BrokerCodeName
where brk.BrokerCode.ToUpper() == cf.Broker.Split('-')[0].ToUpper()
select brk.BrokerName).FirstOrDefault(),


Can I join BrokerCodeName with QCHelperall list with equi join. If possible, then please review and give me recommendation as to where one left join could be between QCHelperall & ToggleDataAll and one equi join between BrokerCodeName with QCHelperall in the same place.



Can you review this code for performance and best coding practices?










share|improve this question









New contributor




user197025 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







$endgroup$












  • $begingroup$
    how to equi join BrokerCodeName & QCHelperall in above join? if i could join then performance will be better? now i am finding data in BrokerCodeName list for each iteration....does it kill the performance ? please some one answer & guide me.
    $endgroup$
    – user197025
    yesterday






  • 1




    $begingroup$
    The current question title, which states your concerns about the code, is too general to be useful here. The site standard is for the title to simply state the task accomplished by the code. Please see How to Ask for examples, and revise the title accordingly.
    $endgroup$
    – Jamal
    23 hours ago














-1












-1








-1





$begingroup$


See my code:



var cfToggleList = (from cf in QCHelperall
join toggle in ToggleDataAll
on new { val = cf.Section.Trim().ToUpper(),
val1 = cf.Li.Trim().ToUpper(),
val2 = cf.Period.Replace("A", "").Replace("E", "").Trim().ToUpper(),
val3 = cf.Broker.Trim().ToUpper() }

equals new { val = toggle.Section.Trim().ToUpper(),
val1 = toggle.Lineitem.Trim().ToUpper(),
val2 = toggle.Period.Trim().ToUpper(),
val3 = toggle.Broker.Trim().ToUpper() }

into tempJoin
from leftJoin in tempJoin.DefaultIfEmpty()
select new QCHelper()
{
Broker = cf.Broker,
BrokerName = (from brk in BrokerCodeName
where brk.BrokerCode.ToUpper() == cf.Broker.Split('-')[0].ToUpper()
select brk.BrokerName).FirstOrDefault(),
Section = cf.Section,
Li = cf.Li,
StandardDate = cf.Period,
Value = cf.Value,
FycheckToggle = leftJoin == null ? string.Empty : (leftJoin.ToggleText.Contains("FYCHECKTOGGLE") ? leftJoin.ToggleText : string.Empty),
QcCheckToggle = leftJoin == null ? string.Empty : (leftJoin.ToggleText.Contains("QCCHECKTOGGLE") ? leftJoin.ToggleText : string.Empty)
}).ToList<QCHelper>();


There is a left join between two lists, called QCHelperall & ToggleDataAll and for each iteration, I am fetching data from another list based on match:



    BrokerName = (from brk in BrokerCodeName
where brk.BrokerCode.ToUpper() == cf.Broker.Split('-')[0].ToUpper()
select brk.BrokerName).FirstOrDefault(),


Can I join BrokerCodeName with QCHelperall list with equi join. If possible, then please review and give me recommendation as to where one left join could be between QCHelperall & ToggleDataAll and one equi join between BrokerCodeName with QCHelperall in the same place.



Can you review this code for performance and best coding practices?










share|improve this question









New contributor




user197025 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







$endgroup$




See my code:



var cfToggleList = (from cf in QCHelperall
join toggle in ToggleDataAll
on new { val = cf.Section.Trim().ToUpper(),
val1 = cf.Li.Trim().ToUpper(),
val2 = cf.Period.Replace("A", "").Replace("E", "").Trim().ToUpper(),
val3 = cf.Broker.Trim().ToUpper() }

equals new { val = toggle.Section.Trim().ToUpper(),
val1 = toggle.Lineitem.Trim().ToUpper(),
val2 = toggle.Period.Trim().ToUpper(),
val3 = toggle.Broker.Trim().ToUpper() }

into tempJoin
from leftJoin in tempJoin.DefaultIfEmpty()
select new QCHelper()
{
Broker = cf.Broker,
BrokerName = (from brk in BrokerCodeName
where brk.BrokerCode.ToUpper() == cf.Broker.Split('-')[0].ToUpper()
select brk.BrokerName).FirstOrDefault(),
Section = cf.Section,
Li = cf.Li,
StandardDate = cf.Period,
Value = cf.Value,
FycheckToggle = leftJoin == null ? string.Empty : (leftJoin.ToggleText.Contains("FYCHECKTOGGLE") ? leftJoin.ToggleText : string.Empty),
QcCheckToggle = leftJoin == null ? string.Empty : (leftJoin.ToggleText.Contains("QCCHECKTOGGLE") ? leftJoin.ToggleText : string.Empty)
}).ToList<QCHelper>();


There is a left join between two lists, called QCHelperall & ToggleDataAll and for each iteration, I am fetching data from another list based on match:



    BrokerName = (from brk in BrokerCodeName
where brk.BrokerCode.ToUpper() == cf.Broker.Split('-')[0].ToUpper()
select brk.BrokerName).FirstOrDefault(),


Can I join BrokerCodeName with QCHelperall list with equi join. If possible, then please review and give me recommendation as to where one left join could be between QCHelperall & ToggleDataAll and one equi join between BrokerCodeName with QCHelperall in the same place.



Can you review this code for performance and best coding practices?







c# performance






share|improve this question









New contributor




user197025 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




user197025 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited yesterday









esote

3,02611141




3,02611141






New contributor




user197025 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked yesterday









user197025user197025

42




42




New contributor




user197025 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





user197025 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






user197025 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • $begingroup$
    how to equi join BrokerCodeName & QCHelperall in above join? if i could join then performance will be better? now i am finding data in BrokerCodeName list for each iteration....does it kill the performance ? please some one answer & guide me.
    $endgroup$
    – user197025
    yesterday






  • 1




    $begingroup$
    The current question title, which states your concerns about the code, is too general to be useful here. The site standard is for the title to simply state the task accomplished by the code. Please see How to Ask for examples, and revise the title accordingly.
    $endgroup$
    – Jamal
    23 hours ago


















  • $begingroup$
    how to equi join BrokerCodeName & QCHelperall in above join? if i could join then performance will be better? now i am finding data in BrokerCodeName list for each iteration....does it kill the performance ? please some one answer & guide me.
    $endgroup$
    – user197025
    yesterday






  • 1




    $begingroup$
    The current question title, which states your concerns about the code, is too general to be useful here. The site standard is for the title to simply state the task accomplished by the code. Please see How to Ask for examples, and revise the title accordingly.
    $endgroup$
    – Jamal
    23 hours ago
















$begingroup$
how to equi join BrokerCodeName & QCHelperall in above join? if i could join then performance will be better? now i am finding data in BrokerCodeName list for each iteration....does it kill the performance ? please some one answer & guide me.
$endgroup$
– user197025
yesterday




$begingroup$
how to equi join BrokerCodeName & QCHelperall in above join? if i could join then performance will be better? now i am finding data in BrokerCodeName list for each iteration....does it kill the performance ? please some one answer & guide me.
$endgroup$
– user197025
yesterday




1




1




$begingroup$
The current question title, which states your concerns about the code, is too general to be useful here. The site standard is for the title to simply state the task accomplished by the code. Please see How to Ask for examples, and revise the title accordingly.
$endgroup$
– Jamal
23 hours ago




$begingroup$
The current question title, which states your concerns about the code, is too general to be useful here. The site standard is for the title to simply state the task accomplished by the code. Please see How to Ask for examples, and revise the title accordingly.
$endgroup$
– Jamal
23 hours ago










0






active

oldest

votes












Your Answer





StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
});
});
}, "mathjax-editing");

StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "196"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});






user197025 is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f217012%2fc-list-how-to-do-3-joins-for-higher-performance%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes








user197025 is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















user197025 is a new contributor. Be nice, and check out our Code of Conduct.













user197025 is a new contributor. Be nice, and check out our Code of Conduct.












user197025 is a new contributor. Be nice, and check out our Code of Conduct.
















Thanks for contributing an answer to Code Review Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f217012%2fc-list-how-to-do-3-joins-for-higher-performance%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Fairchild Swearingen Metro Inhaltsverzeichnis Geschichte | Innenausstattung | Nutzung | Zwischenfälle...

Pilgersdorf Inhaltsverzeichnis Geografie | Geschichte | Bevölkerungsentwicklung | Politik | Kultur...

Marineschifffahrtleitung Inhaltsverzeichnis Geschichte | Heutige Organisation der NATO | Nationale und...