Archives by Tag 'C#'

C# events are actually accessors

By admin - Last updated: Wednesday, October 15, 2008

An interesting feature of C# I discovered recently is that events are actually accessors into Multicast Delegates, much like properties are accessors into other fields.

private string myData;
public string MyData // A property
{
get { return myData; } // called when the property is read
set { myData = value; } // called when [...]

How to get a (non-visual) ComponentModel.Component’s parent Form or Control

By admin - Last updated: Friday, March 7, 2008

I recently ran into the need to get the reference of the parent form of a Component that I was creating. The problem is that Components, unlike Controls, don’t have a Parent property, nor any other simple way of getting it. I’ve browsed around for solutions, but I could only find vague references to what [...]