Click here to Skip to main content
15,868,016 members
Home / Discussions / C#
   

C#

 
QuestionCan you run application (built in C#) from PC to Mobile phone via Bluetooth Pin
LAPEC4-Jan-12 13:28
LAPEC4-Jan-12 13:28 
AnswerRe: Can you run application (built in C#) from PC to Mobile phone via Bluetooth Pin
Dave Kreskowiak4-Jan-12 15:21
mveDave Kreskowiak4-Jan-12 15:21 
GeneralSeeking a C# mentor. Pin
Member 85400644-Jan-12 12:36
Member 85400644-Jan-12 12:36 
GeneralRe: Seeking a C# mentor. Pin
Richard Andrew x644-Jan-12 13:17
professionalRichard Andrew x644-Jan-12 13:17 
GeneralRe: Seeking a C# mentor. Pin
Member 85400644-Jan-12 13:40
Member 85400644-Jan-12 13:40 
GeneralRe: Seeking a C# mentor. Pin
fjdiewornncalwe5-Jan-12 4:40
professionalfjdiewornncalwe5-Jan-12 4:40 
QuestionFeedback on this Tree class design? Pin
SledgeHammer014-Jan-12 11:06
SledgeHammer014-Jan-12 11:06 
AnswerRe: Feedback on this Tree class design? Pin
Pete O'Hanlon5-Jan-12 2:37
subeditorPete O'Hanlon5-Jan-12 2:37 
SledgeHammer01 wrote:
Perhaps if I add some methods to NodeCollection to find Nodes by Value it will
make it better?

Hmmmm. One thought occurs to me - what happens if the value you want to return is in the root node? You'd have to check that value first, and then call the NodeCollection check. If the check is part of the Node instead, and that knows how to iterate over child nodes then that would simplify the end code somewhat (granted it would make the internal logic slightly more complex). Actually, a simple extension to this would allow you to put it into the Tree class itself, and then that would trigger the Node/NodeCollection checks - this way, the end dev only has to use something like:
C#
var node = myTree.FindNodeByValue(myValue);
Thinking this through though, there is a particular smell in place in that you actually have to supply a full copy of value that can be used in an equality test - perhaps you could extend to include an equality test as well (as a Predicate for instance), so that complex objects could be retrieved off one of their properties (useful if you want to search for a particular ID for instance).

As for the retrieving by child position, this code seems very reminiscent of manipulating XML. Again, things could be made simpler by providing methods at the Tree level which would retrieve the relevant child without having to resort to the Root node in external code. As this is all working off a Node object, you could have a method that looks something like this (completely untested, so there may be some kinks in it):
C#
public Node<T> GetNodeByPosition(int position)
{
  return this.Root.Children[position];
}
The Node class could have a similar method, which would allow the dev to chain results together.

Anyway, these are just some thoughts off the top of my head - I'd really have to sit down and work through this some more.

[Edit]Not sure why your post was 1-voted. I don't see anything inherently wrong with the post.

Forgive your enemies - it messes with their heads

"Mind bleach! Send me mind bleach!" - Nagy Vilmos


My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility



modified 5-Jan-12 8:50am.

GeneralRe: Feedback on this Tree class design? Pin
SledgeHammer015-Jan-12 6:45
SledgeHammer015-Jan-12 6:45 
GeneralRe: Feedback on this Tree class design? Pin
SledgeHammer015-Jan-12 10:11
SledgeHammer015-Jan-12 10:11 
AnswerRe: Feedback on this Tree class design? Pin
BillWoodruff5-Jan-12 17:28
professionalBillWoodruff5-Jan-12 17:28 
AnswerRe: Feedback on this Tree class design? Pin
RobCroll6-Jan-12 1:40
RobCroll6-Jan-12 1:40 
GeneralRe: Feedback on this Tree class design? Pin
BillWoodruff7-Jan-12 23:52
professionalBillWoodruff7-Jan-12 23:52 
QuestionNAudio Pin
Member 20880664-Jan-12 9:11
Member 20880664-Jan-12 9:11 
AnswerRe: NAudio Pin
RobCroll6-Jan-12 1:58
RobCroll6-Jan-12 1:58 
Questionhelp with code for convert from csv to excell Pin
goldsoft4-Jan-12 1:59
goldsoft4-Jan-12 1:59 
AnswerRe: help with code for convert from csv to excell Pin
Dave Kreskowiak4-Jan-12 3:22
mveDave Kreskowiak4-Jan-12 3:22 
GeneralRe: help with code for convert from csv to excell Pin
goldsoft4-Jan-12 4:09
goldsoft4-Jan-12 4:09 
GeneralRe: help with code for convert from csv to excell Pin
Dave Kreskowiak4-Jan-12 4:42
mveDave Kreskowiak4-Jan-12 4:42 
GeneralRe: help with code for convert from csv to excell Pin
jschell4-Jan-12 8:19
jschell4-Jan-12 8:19 
GeneralRe: help with code for convert from csv to excell Pin
Dave Kreskowiak4-Jan-12 9:17
mveDave Kreskowiak4-Jan-12 9:17 
GeneralRe: help with code for convert from csv to excell Pin
jschell6-Jan-12 8:36
jschell6-Jan-12 8:36 
GeneralRe: help with code for convert from csv to excell Pin
fjdiewornncalwe4-Jan-12 9:19
professionalfjdiewornncalwe4-Jan-12 9:19 
GeneralRe: help with code for convert from csv to excell Pin
jschell6-Jan-12 8:37
jschell6-Jan-12 8:37 
Questioncalling ShowDialog() Pin
MahaKh4-Jan-12 1:10
MahaKh4-Jan-12 1:10 

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.