tags:

views:

31

answers:

1

I want to take pa but empty MG props.

Parent pa = new Parent()
               {
                   MC = new Child[]
                            {
                                new Child() {M1 = 1},
                                new Child() {M1 = 2},
                                new Child() {M1 = 3},
                            },
                   MG = new GrandChild[]
                            {
                                new GrandChild() {M2 = "1"},
                                new GrandChild() {M2 = ""},
                                new GrandChild() {M2 = ""},
                                new GrandChild() {M2 = "4"},
                            },
                   MP = "just string prop",
               };

I know this is not true but wanna take my object like this way:

var vv = pa.MG.Where(_p=>_p.M2!="").Select(_k=>_k.**parent**) 
A: 

pa.MG = pa.MG.Where(gc => gc.M2 != "").ToArray();

David B
yes... IT isss... Why i didn't think to change property's value :(
uzay95