AI OnAI Off
UnifiedFile file = HostingEnvironment.VirtualPathProvider.GetFile(virtualPath) as UnifiedFile;
file.Summary.Comments = "Changed from code";
file.Summary.Dictionary["ImageWidth"] = 1234;
file.Summary.SaveChanges();
All values are stored in a hashtable so access is quite fast but the file object itself is serialized to and from the database so I would keep an eye open for performance issues because I do not know how well the caching works and of course, updates would always trigger database activity.
Also worth to mention is that uploaded files are versioned and each version can have a diffrent set of meta data.
Regards,
Fredrik Haglund
INEXOR AB - http://blog.fredrikhaglund.se/