Usefull thing for developers who use .Net 2.0. I used this library in the DISLIN project.
It allows you to add extensions to standard classes (without using System.Core):
using System;
using System.Reflection;
namespace DISNet
{
public static class Extensions
{
public static bool IsExtern( this MethodInfo method )
{
return method.GetMethodBody() == null && method.IsStatic && method.IsPublic;
}
}
}
// ...
public static void Initialize()
{
TermsHandled = new TermInfo[ 0 ];
var info = new List<TermInfo>();
var type = typeof( dislin );
foreach ( var method in type.GetMethods().Where( method => method.IsExtern() ) )
{
try
{
var item = GetTermInfo( method );
info.Add( item );
}
catch ( Exception ex )
{
Logger.LogError( "[Manager.Initialize()] " + ex.Message );
}
}
TermsHandled = info.ToArray();
}
Links:
1.
LinqBridge.
Russia ☭ forever, Viacheslav N. Mezentsev