Author Topic: C# Almost a typedef..  (Read 2359 times)

0 Members and 1 Guest are viewing this topic.

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8696
  • AKA Daniel
C# Almost a typedef..
« on: November 07, 2008, 11:47:36 PM »
I saw this trick, thought it was cool.

Code: [Select]
#region
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;

using Autodesk.AutoCAD.GraphicsInterface;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.Windows;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.LayerManager;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Colors;

using AcAp = Autodesk.AutoCAD.ApplicationServices;
using AcEd = Autodesk.AutoCAD.EditorInput;
using AcGe = Autodesk.AutoCAD.Geometry;
using AcRx = Autodesk.AutoCAD.Runtime;
using AcDb = Autodesk.AutoCAD.DatabaseServices;
using AcWd = Autodesk.AutoCAD.Windows;

//++-- cool use of using
using LispLisp = System.Collections.Generic.List<Autodesk.AutoCAD.DatabaseServices.TypedValue>;//++-- <<<-----

#endregion

[assembly: CommandClass(typeof(ExecMethod.Commands))]
//++--
namespace ExecMethod
{
  public class Commands
  {
    [LispFunction("doit")]
    public static Object doit(ResultBuffer buf)
    {
      Editor ed = AcAp.Application.DocumentManager.MdiActiveDocument.Editor;
      try
      {
        if (buf == null)
          return false;

        LispLisp ll = new LispLisp(buf.AsArray());

        ll.ForEach(X => ed.WriteMessage("\n{0}", X.Value));
      }
      catch (System.Exception ex)
      {
        ed.WriteMessage("\n" + ex.Message);
      }
      return true;
    }
  }
}

TonyT

  • Guest
Re: C# Almost a typedef..
« Reply #1 on: November 08, 2008, 04:34:14 AM »
I saw this trick, thought it was cool.

Code: [Select]

//++-- cool use of using
using LispLisp = System.Collections.Generic.List<Autodesk.AutoCAD.DatabaseServices.TypedValue>;//++-- <<<---


I do that a lot with KeyValuePair<>