A cool way to use Properties in a SharePoint Web Part
Properties are nothing new in OOP, but something that I stumbled upon not too long ago was a cool thing that you could do with properties. My work was SharePoint web part related, but I imagine that it would work with any customized object that can be called in your page. I needed a way to reuse a webpart that was accessing a single User Profile field so that I could display any field I wished, as many as I wanted just by simply dropping a new custom web part on my page in SPD and simply adding a name/value pair to the HTML. The idea here is to build your web part with a property: public string CustomProperty { get { return _CustomProperty; } set { _CustomProperty= value; } } Nothing crazy here but later in the code we check the CustomProperty property for a value and if it's valid, we go and grab the field from the User Profile database and then display it in the web part: <WpNs0:ProfilePropertyPart runat="server...