//Constructor used when deserializing data. public Thought(SerializationInfo info, StreamingContext context) { try { Title = (String)info.GetValue("Title", typeof(String)); } catch (SerializationException e) { Title = "Corrupted Thought"; } try { Description = (String)info.GetValue("Description", typeof(String)); } catch (SerializationException e) { Description = String.Empty; } try { created = (DateTime)info.GetValue("created", typeof(DateTime)); } catch (SerializationException e) { created = DateTime.Now; } try { tState = (thought_state)info.GetValue("tState", typeof(thought_state)); } catch (SerializationException e) { tState = thought_state.active; } try { Category = (String)info.GetValue("Category", typeof(String)); } catch(SerializationException e) { Category = unCat; } try { lastUpdated = (DateTime)info.GetValue("lastUpdated", typeof(DateTime)); } catch (SerializationException e) { lastUpdated = DateTime.Now; } }
public Thought() { Title = "Empty Thought"; Description = String.Empty; created = DateTime.Now; lastUpdated = DateTime.Now; tState = thought_state.active; Category = unCat; }
public Thought(String inTitle, String inDescription = "", String inCategory = "Uncategorized") { Title = inTitle; Description = inDescription; created = DateTime.Now; lastUpdated = DateTime.Now; tState = thought_state.active; Category = inCategory; }