10 Replies - 1893 Views - Last Post: 07 April 2019 - 08:25 PM Rate Topic: -----

#1 Skydiver   User is offline

  • Code herder
  • member icon

Reputation: 7053
  • View blog
  • Posts: 23,974
  • Joined: 05-May 12

From a 11 year Microsoft MVP, no less

Posted 21 February 2019 - 06:56 AM

This brand new code is written by a 11-year Microsoft MVP:
private void Traverse(T node)
{
    if (_stop)
    {
        return;
    }
 
    var isHirarchyNode = _provider.IsHierarchyNode(node);
 
    if (isHirarchyNode && node != null)
    {
        _nodePath.Add(node);
    }
 
    if (node != null)
    {
        onloadNode(node);
    }
 
    var children = _provider.LoadChildren(node);
    if (children == null)
    {
        goto end;
    }
 
    foreach (var childNode in children)
    {
        Traverse(childNode);

        if (_stop)
        {
            goto end;
        }
    }
 
end:
    if (isHirarchyNode && node != null)
    {
        _nodePath.Remove(node);
    }
}



Is This A Good Question/Topic? 0
  • +

Replies To: From a 11 year Microsoft MVP, no less

#2 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 15262
  • View blog
  • Posts: 61,154
  • Joined: 12-June 08

Re: From a 11 year Microsoft MVP, no less

Posted 21 February 2019 - 07:38 AM

At least we know they are still human.
Was This Post Helpful? 0
  • +
  • -

#3 andrewsw   User is offline

  • never lube your breaks
  • member icon

Reputation: 6818
  • View blog
  • Posts: 28,228
  • Joined: 12-December 12

Re: From a 11 year Microsoft MVP, no less

Posted 21 February 2019 - 07:53 AM

isHirarchyNode bugs me. Is it simply a misspelling that has never been noticed or, much worse, a lazy naming attempt. I would even prefer isHierarchyNode2.
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 15262
  • View blog
  • Posts: 61,154
  • Joined: 12-June 08

Re: From a 11 year Microsoft MVP, no less

Posted 21 February 2019 - 07:56 AM

Pffffsstt.. too many characters. isHN2 ! :D
Was This Post Helpful? 0
  • +
  • -

#5 andrewsw   User is offline

  • never lube your breaks
  • member icon

Reputation: 6818
  • View blog
  • Posts: 28,228
  • Joined: 12-December 12

Re: From a 11 year Microsoft MVP, no less

Posted 21 February 2019 - 08:11 AM

isHirarchyNodeNotIsHierarchyNode = falsy;

Was This Post Helpful? 2
  • +
  • -

#6 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 15262
  • View blog
  • Posts: 61,154
  • Joined: 12-June 08

Re: From a 11 year Microsoft MVP, no less

Posted 21 February 2019 - 08:29 AM

Please..

isHirarchyNodeButNotTheOtherHierarchyNodeNode
Was This Post Helpful? 2
  • +
  • -

#7 andrewsw   User is offline

  • never lube your breaks
  • member icon

Reputation: 6818
  • View blog
  • Posts: 28,228
  • Joined: 12-December 12

Re: From a 11 year Microsoft MVP, no less

Posted 21 February 2019 - 08:54 AM

noNodeIsGoodNodeNode
Was This Post Helpful? 0
  • +
  • -

#8 hexagod   User is offline

  • 😂😂😂
  • member icon

Reputation: 31
  • View blog
  • Posts: 577
  • Joined: 29-October 16

Re: From a 11 year Microsoft MVP, no less

Posted 21 February 2019 - 09:46 AM

modi123_1 😂😂😂

lazy camel case on line 17 as-well onloadNode(node);

how did you get access to MSFT source? And what is that from?
Was This Post Helpful? 0
  • +
  • -

#9 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 15262
  • View blog
  • Posts: 61,154
  • Joined: 12-June 08

Re: From a 11 year Microsoft MVP, no less

Posted 21 February 2019 - 09:54 AM

@hexag - quite a bit is on github now.

Though that looks to be from:
https://gunnarpeipma...sharepoint-sql/
Was This Post Helpful? 0
  • +
  • -

#10 Skydiver   User is offline

  • Code herder
  • member icon

Reputation: 7053
  • View blog
  • Posts: 23,974
  • Joined: 05-May 12

Re: From a 11 year Microsoft MVP, no less

Posted 21 February 2019 - 11:10 AM

Yup. And I misspelled "hierarchy" in the comment I posted.
Was This Post Helpful? 0
  • +
  • -

#11 milleja46   User is offline

  • D.I.C Regular

Reputation: 3
  • View blog
  • Posts: 279
  • Joined: 17-December 09

Re: From a 11 year Microsoft MVP, no less

Posted 07 April 2019 - 08:25 PM

Even from what I know of traversal, what I want to know why are there so many if's? Just trying to make sense of it because of those makes my head hurt....I used maybe 2 when I did a similar function last year in data structures. This coming from the guy who questions some of his sanity whenever he does try to code now a days(which isn't enough on either counts). >.<
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1