C# codes for HAF