If you are a .NET developer then you’ve probably heard or read about CLR metadata. In this blog post I will try to give you a pragmatic view of what CLR metadata is and how to work with it. You are going to learn how to use unmanaged metadata API from C# code. I will …
Tag Archives: C#
Parsing “Unsafe” Method Signatures
If you’ve ever used JustMock then you should be familiar with code fragments like this one: public interface IFoo { byte Bar(int i, string s, long l); } var foo = Mock.Create<IFoo>(); Mock.Arrange(() => foo.Bar(123, “test”, 321)).Returns(5); The interesting thing in this code is in the Arrange method. Its signature is as follows: public static …
Thoughts on C# Compiler
In 2010 I wrote the blog post Fun with pointers in C#. Back then, I thought it was fun. Today, I am not so sure. Lets take a look at the following code fragment: using System; namespace ClassLibrary1 { public class Class1 { unsafe public void Method1(ref object* obj) { Console.WriteLine(obj->ToString()); } } } If …