how to add System.Component library

Discussion about the open-source Phalanger [?] project.

how to add System.Component library

Postby phalanger@codeplex » September 19th, 2006, 9:53 am

Hi,
I'm a new to Phalanger.
Pls tell me how to include System.ComponentModel Libraray to phalanger? This library is not added in my machine.config file.can you tell me how to add this library to run my code?
Thanks...
phalanger@codeplex
 
Posts: 8
Joined: January 7th, 2012, 8:57 pm

RE: how to add System.Component library

Postby Lada Prosek » September 20th, 2006, 9:18 am

Types from the System.ComponentModel are implemented in the framework assembly called "System", which is added to machine.config during install. You should be able to use these types right away.

<?  $x = new System:::ComponentModel:::DateTimeConverter;  echo $x->ConvertFromString("Aug 1 2006");?>

or

<?  import namespace System:::ComponentModel;   $x = new DateTimeConverter;  echo $x->ConvertFromString("Aug 1 2006");?>
Lada Prosek
 
Posts: 47
Joined: January 7th, 2012, 8:52 pm

RE: how to add System.Component library

Postby nagraj@codeplex » September 22nd, 2006, 11:47 am

<?php

import namespace System:::Drawing;

......
........

$x=new Image("sample.image");

......
.....
?>

This will generate an error saying
Instantiation of abstract class or interface 'System:::Drawing:::Image'

nagraj@codeplex
 
Posts: 24
Joined: January 7th, 2012, 8:55 pm

RE: how to add System.Component library

Postby Lada Prosek » September 22nd, 2006, 1:52 pm

The Image class is abstract.

[SerializableAttribute] [ComVisibleAttribute(true)] public abstract class Image : MarshalByRefObject, ISerializable, ICloneable, IDisposable
Lada Prosek
 
Posts: 47
Joined: January 7th, 2012, 8:52 pm

RE: how to add System.Component library

Postby nagraj@codeplex » September 25th, 2006, 7:27 am

could you give more information
nagraj@codeplex
 
Posts: 24
Joined: January 7th, 2012, 8:55 pm

RE: how to add System.Component library

Postby Lada Prosek » September 25th, 2006, 9:47 am

MSDN: Abstract classes act as expressions of general concepts from which more specific classes can be derived. You cannot create an object of an abstract class type; however, you can use pointers and references to abstract class types.

Image cannot be instantiated, but you can create instances of its subclasses (aka derived classes), namely Bitmap and Metafile.

<?  $x = new System:::Drawing:::Bitmap("C:\\Windows\\Gone Fishing.bmp");  var_dump($x instanceof System:::Drawing:::Bitmap);  var_dump($x instanceof System:::Drawing:::Image);?>

This prints true twice, because the Bitmap is obviously a Bitmap and it is also an Image because Bitmap is derived from Image. You can still use Image in situations like this:

  function PrintImage(System:::Drawing:::Image $image)  {    // ...  }

The typehint says that the function can be called with anything that is in Image, i.e. both an instance of Bitmap and an instance of Metafile would be valid arguments.
Lada Prosek
 
Posts: 47
Joined: January 7th, 2012, 8:52 pm

RE: how to add System.Component library

Postby nagraj@codeplex » September 26th, 2006, 12:23 pm

thanks,

it got worked.
nagraj@codeplex
 
Posts: 24
Joined: January 7th, 2012, 8:55 pm


Return to Phalanger project

Who is online

Users browsing this forum: No registered users and 25 guests

cron

User Control Panel

Login

Who is online

In total there are 25 users online :: 0 registered, 0 hidden and 25 guests (based on users active over the past 5 minutes)
Most users ever online was 297 on March 29th, 2024, 7:06 am

Users browsing this forum: No registered users and 25 guests