Home About

Using LinqPad to Enumerate SQLCLR Types and Methods

August 25, 2013

In the process of deploying a SQL CLR assembly I needed to be able to check whether my new version was correctly installed into the SQL Server as I had expected.

So using a bit of LinqPad code I can enumerate the content of any non-microsoft Assemblies. It’s not fancy, but it sure saves a lot of stuffing around if you can’t work out why a given method isn’t there. Or maybe you want to work out what an unknown Assembly does.

foreach (var file in sys.Assembly_files.Where(p => !p.Name.StartsWith("microsoft"))) {


  Assembly assembly = Assembly.Load(file.Content.ToArray());

  foreach (var type in assembly.GetTypes().Where(p => p.IsClass && !p.Name.StartsWith("<"))) {
    Console.WriteLine("\t" + type.Name);

    foreach (var method in type.GetMethods(BindingFlags.Public | BindingFlags.Static)) {
      Console.WriteLine("\t\t" + method.ToString());