Click here to Skip to main content
15,907,910 members
Home / Discussions / C#
   

C#

 
GeneralRe: I do not understand why the error ! :S Pin
Not Active1-Jun-11 3:38
mentorNot Active1-Jun-11 3:38 
GeneralRe: I do not understand why the error ! :S Pin
BobJanova1-Jun-11 4:12
BobJanova1-Jun-11 4:12 
AnswerRe: I do not understand why the error ! :S Pin
Pete O'Hanlon1-Jun-11 3:25
mvePete O'Hanlon1-Jun-11 3:25 
GeneralRe: I do not understand why the error ! :S Pin
ismail201-Jun-11 3:33
ismail201-Jun-11 3:33 
GeneralRe: I do not understand why the error ! :S Pin
Not Active1-Jun-11 3:37
mentorNot Active1-Jun-11 3:37 
GeneralRe: I do not understand why the error ! :S Pin
ismail201-Jun-11 3:44
ismail201-Jun-11 3:44 
GeneralRe: I do not understand why the error ! :S PinPopular
Pete O'Hanlon1-Jun-11 3:54
mvePete O'Hanlon1-Jun-11 3:54 
QuestionLogical issue with a recursive function call Pin
John-ph1-Jun-11 2:23
John-ph1-Jun-11 2:23 
trying to figure out a way to get it right...

1. items in a collection fall in one of the category parent or orphan
2. items in a collection may have one or more independent parent / one or more orphan
3. Both (Parent and Orphan) may or maynot have Individual behaviour
4. If a parent has one or null behaviour it should be applied to children. Individual behaviour of children item be hidden
5. If a orphan has one or null behaviour it should be applied to it
6. An item will have only one or null behaviour

trying to rephrase the following code...

private static void ApplyBehaviour(IEnumerator items, Behaviour behaviour = null)  
        {
	        while(items.MoveNext())
		        {
			        ItemModel item = (ItemModel)items.Current;
		
			        if(item.type = parent)
			        {
				        parentModel parentModel = (parentModel)item;
				
				        if(parentModel.HasBehaviour)
				        {
					        behaviour = parentModel.Behaviour;
				        }
				
				        ApplyBehaviour(parentModel.Children.GetEnumerator(), behaviour);
	                                 
                                         if(parentModel.HasBehaviour)
				        {
					        behaviour = null;
				        }
			        }			
			
			        item.Behaviour = behaviour;
		        }
	        }
        }



inital call will be ApplyBehaviour(items);

if two items with common parent and different behaviour, then the above code gets the
first item and children right...takes the parent behaviour but the second item retains its behaviour and applie it to children.
not sure whether i have explained in a way that someone can read and understand
- Regards -
   J O N


     A good thing is a bad thing if it keeps you from the best thing. - Dr. Adrian Rogers


modified on Wednesday, June 1, 2011 8:37 AM

AnswerRe: Logical issue with a recursive function call Pin
dasblinkenlight1-Jun-11 5:37
dasblinkenlight1-Jun-11 5:37 
QuestionMemory expensive rubber band selection? Pin
Chesnokov Yuriy31-May-11 23:10
professionalChesnokov Yuriy31-May-11 23:10 
AnswerRe: Memory expensive rubber band selection? Pin
BobJanova31-May-11 23:36
BobJanova31-May-11 23:36 
AnswerRe: Memory expensive rubber band selection? Pin
Chesnokov Yuriy1-Jun-11 0:42
professionalChesnokov Yuriy1-Jun-11 0:42 
AnswerRe: Memory expensive rubber band selection? Pin
Luc Pattyn1-Jun-11 0:42
sitebuilderLuc Pattyn1-Jun-11 0:42 
GeneralRe: Memory expensive rubber band selection? Pin
Chesnokov Yuriy1-Jun-11 0:56
professionalChesnokov Yuriy1-Jun-11 0:56 
AnswerRe: Memory expensive rubber band selection? Pin
Eddy Vluggen1-Jun-11 1:00
professionalEddy Vluggen1-Jun-11 1:00 
GeneralRe: Memory expensive rubber band selection? Pin
BobJanova1-Jun-11 1:24
BobJanova1-Jun-11 1:24 
GeneralRe: Memory expensive rubber band selection? Pin
Pete O'Hanlon1-Jun-11 1:41
mvePete O'Hanlon1-Jun-11 1:41 
AnswerRe: Memory expensive rubber band selection? Pin
Luc Pattyn1-Jun-11 1:41
sitebuilderLuc Pattyn1-Jun-11 1:41 
QuestionRe: Memory expensive rubber band selection? Pin
Chesnokov Yuriy1-Jun-11 1:56
professionalChesnokov Yuriy1-Jun-11 1:56 
AnswerRe: Memory expensive rubber band selection? Pin
_Erik_1-Jun-11 3:47
_Erik_1-Jun-11 3:47 
GeneralRe: Memory expensive rubber band selection? Pin
Chesnokov Yuriy1-Jun-11 7:18
professionalChesnokov Yuriy1-Jun-11 7:18 
GeneralRe: Memory expensive rubber band selection? Pin
_Erik_2-Jun-11 1:51
_Erik_2-Jun-11 1:51 
QuestionWork with Geotiff in C# Pin
Reza Shojaee31-May-11 22:04
Reza Shojaee31-May-11 22:04 
AnswerRe: Work with Geotiff in C# Pin
Pete O'Hanlon31-May-11 22:32
mvePete O'Hanlon31-May-11 22:32 
Questionabstarct class basic question [modified] Pin
PozzaVecia31-May-11 20:57
PozzaVecia31-May-11 20:57 

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.