Develop and Download Open Source Software

View About DotNet class

category(Tag) tree

file info

category(Tag)
root
file name
DotNetClass
last update
2002-07-12 23:49
type
Plain Text
editor
arton
description
How to use .NET Framework classes in NETRuby
language
English
translate
=begin
==DotNet class
DotNet

===class methods
  using(namespace)

import specified namespace into NETRuby name space. Because NETRuby imports System namespace at startup time, so you don't need to specify it.

* using is also defeined as a function.

   # import WindowsForms into NETRuby
   using "System.Windows.Forms"

  using_list

returns currently imported namespaces as an array of String.

  type_list

returns currently imported System.Type(s) as an array of String.

  new(typename)

define and create .NET Framework class (also known as klass).

It also make automaticaly register a constant into DotNet class, with a name using '_' insetead of '.'.

   using "System.Windows.Forms"
   MsgBox = DotNet.new("MessageBox")
   # MessageBox::Show is static method, so you don't need to instantiate it.
   MsgBox.Show "Hello World !"
   DotNet::System_Windows_Forms_MessageBox.Show "Hello World !"
   NETString = DotNet.new("String") # not Ruby's String, it's System.String.
   s = NETString.Format("{0} is {1}", 5, 'five')
   MsgBox.Show s

===instance methods

no methods are defined, so, It's better to move DotNet to Module from Class ?

=end