This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
Phantom /
| name | age | message | |
|---|---|---|---|
| |
.gitignore | Sat Oct 17 20:03:39 -0700 2009 | |
| |
Phantom.Tests/ | ||
| |
Phantom.sln | Sat Oct 17 20:03:39 -0700 2009 | |
| |
Phantom/ | Sat Oct 17 20:03:39 -0700 2009 | |
| |
Readme.html | Sat Oct 17 22:29:54 -0700 2009 | |
| |
Readme.textile |
Readme.textile
Phantom: Easy reflection in .NET
Phantom is a helper for use relfection in Microsoft.NET.
How to use it?
For begin to use Phantom just put this in your class:
using Phantom;
Simple! This causes appear some extension methods in all objects.
Ok, but what can I do?
Get and set properties, invoke methods, get all properties values and more in objects that you don’t know the Type. Yes, this is cool!
Getting a property value
object person = new Person { Name = "Arthur", Age = 4 };
person.Get("Name");
>> Arthur
Setting a property value
person.Set("Name", "Francine");
Getting all properties values
var properties = person.Values();
foreach(var property in properties)
{
Console.WriteLine(property.Key + " = " + property.Value);
}
>> Name = Arthur
>> Age = 4
Good to use with Anonymous Objects
public void PrintName(object target)
{
Console.WriteLine(target.Get("Name"));
}
PrintName(new { Name = "Wagner" });
>> Wagner
Importing values of another object
object animal = new Animal { Age = 20 };
person.Import(animal);
person.Get("Name");
person.Get("Age");
>> Arthur
>> 20
Invoke a method
object name = "Francine";
name.Invoke("ToUpper");
>> FRANCINE
There are other utilities.
That’s All Folks… for now!








