כשאני עושה את הכתובת בהערה הוא שומר והכל בסדר רק כשמגיע לכתובת הוא רושם הפנייה לאובייקט לא הוגדרה אולי בגלל הvar
edenbelosh
-
-
הוא רושם הפנייה לאובייקט לא הוגדרה למופע של אובייקט כשאני מגיעה לשורה adress.City = (string)el.Element("city").Value;
-
XElement testerRoot; string testerPath = @"testerXml.xml"; XElement traineeRoot; string traineePath = @"traineeXml.xml"; XElement testRoot; string testPath = @"testXml.xml"; XElement configRoot; string configPath = @"configXml.xml"; private static int testNum = 0; testerRoot = new XElement("testers"); testerRoot.Save(testerPath); traineeRoot = new XElement("trainees"); traineeRoot.Save(traineePath); testRoot = new XElement("tests"); testRoot.Save(testPath); configRoot = new XElement("TestNum"); configRoot.Add(new XElement("TestNum", testNum)); configRoot.Save(configPath); if (predicat == null) { return from item in testerRoot.Elements() select ConvertTester(item); } return from item in testerRoot.Elements() let s = ConvertTester(item) where predicat(s) select s; foreach (PropertyInfo item in typeof(BE.Tester).GetProperties()) { if (item.Name != "Adress") TesterElement.Add(new XElement(item.Name, item.GetValue(tester, null))); else { XElement city = new XElement("city", tester.TesterAdress.City); XElement street = new XElement("street", tester.TesterAdress.Street); XElement BuildingNum = new XElement("buildingNum", tester.TesterAdress.BuildingNum); XElement address = new XElement("Adress",street,BuildingNum,city); TesterElement.Add(address); }
זה בערך חלק מהקוד רק של הטסטר
-
אני לומדת שנה שנייה במדעי המחשב ועושה פרוייקט בWPF ונקלתי בבעיה אני מוציאה מהקובץ נתונים בצורה הבאה וכשאני מגיעה למאפיין כתובת שעשיתי אותו class עיר רחוב ומספר בניין הוא לא נותן. איך אפשר לעשות את זה ? תודה מראש!!
foreach (PropertyInfo item in typeof(BE.Tester).GetProperties()) { TypeConverter typeConverter = TypeDescriptor.GetConverter(item.PropertyType); object convertValue = typeConverter.ConvertFromString(element.Element(item.Name).Value); item.SetValue(tester, convertValue); }
-
@dovid
תודה רבה!!!!!! -
אני בונה תוכנית בסיסית בWPF שנה שנייה בלימודים ויש לי ידע בסיסי בפקדים ובתכנות בC# , אני צריכה לעשות בחלון שעד שאני לא בוחרת מהקומבו בוקס איזה משהו אני לא יכולה לגשת לשום פקד אחר ואני צריכה להשתמש במושגים האלה ולא כל כך הבנתי עד הסוף את המשמעות שלהם
<ComboBox x:Name="UpdateMotherID" HorizontalAlignment="Left" Height="23" Margin="0,4.167,0,6.833"
SelectedValue="{Binding ID_Mother, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=true}"
SelectionChanged="UpdateMotherID_SelectionChanged"
VerticalAlignment="Center" Width="120"/>this.UpdateMotherID.ItemsSource = bl.GetAllMothers();
this.UpdateMotherID.DisplayMemberPath = "ID_Mother";
this.UpdateMotherID.SelectedValuePath = "ID_Mother"; -
יש כמה מושגים שלא הבנתי בWPF אם מישהו יכול לעזור לי
, NotifyOnValidationError, ValidatesOnDataErrors=ValidatesOnExceptions,SelectionChanged ,SelectedValuePath,ItemsSourceDisplayMemberPath
wpf
wpf
wpf
wpf
WPF מושגים
WPF מושגים
WPF מושגים