LinqBridge (Linq for C# 3.0 and .Net 2.0)

LinqBridge (Linq for C# 3.0 and .Net 2.0) - Using Linq for .Net 2.0 applications - Messages

#1 Posted: 5/13/2016 4:59:18 AM
Вячеслав Мезенцев

Вячеслав Мезенцев

1402 likes in 1708 posts.

Group: Moderator

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
2 users liked this post
Davide Carpi 5/13/2016 5:52:00 AM, Andrey Ivashov 5/14/2016 7:17:00 AM
  • New Posts New Posts
  • No New Posts No New Posts