hi i am a beginner in C# programming.Can anybody tell me what happens in the code lines for these 2 classes :
using System; using System.Collections.ObjectModel; using System.Collections.Generic; using System.Text; using Wilson.ORMapper;
namespace WindowsApplication3.Data { public class DataObject { private int id = 0; public int ID { get { return this.id; } }
private LogEntryCollection logEntries; public LogEntryCollection LogEntries { get { if (logEntries == null) { logEntries = new LogEntryCollection(this);
OPathQuery<LogEntry> opath = new OPathQuery<LogEntry>("ReferringID = " + this.ID + " AND Type = '" + this.GetType().ToString() + "'"); Collection<LogEntry> os = DataManager.Current.Engine.GetCollection<LogEntry>(opath); foreach (LogEntry le in os) logEntries.Add(le); }
return logEntries; } }
public void Delete() { if (this.id > 0) DataManager.Current.Engine.MarkForDeletion(this); this.Persist(); }
public void Persist() { DataManager.Current.Engine.PersistChanges(this, Wilson.ORMapper.PersistDepth.ObjectGraph); if (logEntries != null) logEntries.Persist(); }
public DataObject() { } } }
using System; using System.Collections; using System.Collections.Generic; using System.Text; using System.Collections.ObjectModel; using System.Diagnostics; using System.Reflection;
namespace WindowsApplication3.Data { public class ObjectCollection<T> : Collection<T> { public ObjectCollection<T> Search(string search) { ObjectCollection<T> completedSearch = new ObjectCollection<T>();
foreach (T o in this) { Type t = o.GetType(); PropertyInfo[] pInfos = t.GetProperties();