Setting a property that does’t exist at compile time in C#

Let’s say you need to set a property that won’t exist at compile time, but will at runtime, say through the magic of runtime replacing of objects.

System.Reflection.PropertyInfo pi = someObject.GetType().GetProperty("SomeProperty");
pi.SetValue(someObject, "new value", null);

In VB.NET, much easier:

Object o = someObject
o.SomeProperty="new value"

What is a stp file?

If you export a “site definition” from sharepoint (from site settings, look and feel, save as site template), then go to the “site template gallery”, save the file. It is a .stp file, which if you rename to .cab, you can unzip it. I use 7z to unzip it there may be other ways. The file contains .000 files, which are C# files, there is a large manifest.xml file, which references to the .000 files, which I think are the “customized/unghosted” pages. All other pages and dependencies are referenced by entries in theses lists:

MetaInfo, Details, SiteFeatures, WebFeatures, Structure, Files, UserLists, WebParts.

Some of the above seem to have been serialized into the manifest file, some are obviously just pointers to things that the template expects to already exist in SharePoint.

There can also be large binary blobs in the file, which gives XML viewers and editors a hard time.


1. Double numbers means you don’t have a relationship set up in the “Diminsion usage” section.
2. Master detail relations are problably “Referenced Diminsions”, the master part will most likely