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 - Сообщения

#1 Опубликовано: 13.05.2016 04:59:18
Вячеслав Мезенцев

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

1402 сообщений из 1708 понравились пользователям.

Группа: 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 пользователям понравился этот пост
Davide Carpi 13.05.2016 05:52:00, Andrey Ivashov 14.05.2016 07:17:00
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений