I am just drawing a blank here. Have a class that I want read only properties on the class but an admin type function that can update a property.
public class Group : Object, INotifyPropertyChanged
{ // this is read only admin is via UserGroupAdmin
public event PropertyChangedEventHandler PropertyChanged;
private void NotifyPropertyChanged(String info)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(info));
}
}
public Int16 ID { get; private set; }
public string Name { get; private set; }
public override bool Equals(Object obj)
{
//Check for null and compare run-time types.
if (obj == null || !(obj is Group)) return false;
Group item = (Group)obj;
return (ID == item.ID);
}
public override int GetHashCode() { return (int)ID; }
public Group(Int16 id, string name)
{ ID = id; Name = name; }
}
What I would like is an admin type function
public group ReviseGroupName (Group group, string revisedName)
{
// write revised name to SQL
// revise group.name
// return revised group
}
The SQL part I know. What I considered was just creating a new group with the same ID and hashcode and returning it.
If the
Adminis a nested class inGroupyou can set the private property in the function: