private static void InsertOnVtVector(VTVector vTVector, String property, Int32 index, String text) { var m = from e1 in vTVector.Elements <Variant>() where e1.Elements <VTLPSTR>().Any(e2 => e2.Text == property) select e1; if (!m.Any()) { if (vTVector.Size == null) { vTVector.Size = new UInt32Value(0U); } vTVector.Size += 2U; var variant1 = new Variant(); var vTlpstr1 = new VTLPSTR { Text = property }; variant1.AppendChild(vTlpstr1); vTVector.InsertAt(variant1, index); var variant2 = new Variant(); var vTInt321 = new VTInt32(); variant2.AppendChild(vTInt321); vTVector.InsertAt(variant2, index + 1); } var targetIndex = 0; foreach (var e in vTVector.Elements <Variant>()) { if (e.Elements <VTLPSTR>().Any(e2 => e2.Text == property)) { vTVector.ElementAt(targetIndex + 1).GetFirstChild <VTInt32>().Text = text; break; } targetIndex++; } }
private static void InsertOnVtVector(VTVector vTVector, String property, Int32 index, String text) { var m = from e1 in vTVector.Elements<Variant>() where e1.Elements<VTLPSTR>().Any(e2 => e2.Text == property) select e1; if (!m.Any()) { if (vTVector.Size == null) vTVector.Size = new UInt32Value(0U); vTVector.Size += 2U; var variant1 = new Variant(); var vTlpstr1 = new VTLPSTR {Text = property}; variant1.AppendChild(vTlpstr1); vTVector.InsertAt(variant1, index); var variant2 = new Variant(); var vTInt321 = new VTInt32(); variant2.AppendChild(vTInt321); vTVector.InsertAt(variant2, index + 1); } var targetIndex = 0; foreach (var e in vTVector.Elements<Variant>()) { if (e.Elements<VTLPSTR>().Any(e2 => e2.Text == property)) { vTVector.ElementAt(targetIndex + 1).GetFirstChild<VTInt32>().Text = text; break; } targetIndex++; } }