How to expose C# async methods in WinRT components

When authoring Windows Runtime (WinRT) components with C# you cannot use the standard C# async Task pattern. Say for example you have code like: public sealed class MyComponent { public async Task<string> SaveToFile(StorageFolder folder, string fileName) { var file = await folder.CreateFileAsync(fileName); var output = MakeRandomString(128); await FileIO.WriteTextAsync(file, output); return output; } } Visual Studio…… Continue reading How to expose C# async methods in WinRT components

Getting rid of C#’s obj folders

A small tip for developers who are irritated with Visual Studio doing this to your pristine source tree: To get the obj directories out of your source tree, and somewhere nicer (your project’s build output directory for example) open up your project’s .csproj file in an external editor. Locate any line that has the <OutputPath>…… Continue reading Getting rid of C#’s obj folders

Printing Generic C++ Containers

Always wanted a simple utility function to print our an arbitrary STL container? Well, so long as your container type support directional iterators… this method I wrote will work perfectly! Its a great example for why templates are awesome #include <sstream> template<typename T> std::string dumpContainer( const T& container, std::string sep ) { typename T::const_iterator itr;…… Continue reading Printing Generic C++ Containers

Compiling Qt with Visual Studio

So your awesome project that you’re developing with Visual Studio, and you want to use Trolltech’s Qt library? Luckily Trolltech provides an awesome Visual Studio plugin that does almost everything Qt creator does (minus Intellisense support for slots). The bad news is that Trolltech doesn’t directly tell you how to go about doing this: Download…… Continue reading Compiling Qt with Visual Studio