[Mono-devel-list] Small Tool
Gaurav Vaish
gvaish at adobe.com
Sat Apr 5 05:24:24 EST 2003
Hi,
Working on the class System.Web.Mobile.MobileCapabilities is nasty -
more so because it has about 70 properties where the code is to almost be
repeated.
For easy working, I made a small tool that does the job for me.
The MakeProps.pl file takes two parameters - name of the property and
type of property and generates the code for me.
For example, if name is CanRenderAfterInputOrSelectElement and type is
bool, it generates the following code:
--------------------------------
private bool canRenderAfterInputOrSelectElement = false;
public bool CanRenderAfterInputOrSelectElement
{
get
{
if(!this.canRenderAfterInputOrSelectElement)
{
if(this["CanRenderAfterInputOrSelectElement"] != null)
{
this.canRenderAfterInputOrSelectElement =
Convert.ToBoolean(this["CanRenderAfterInputOrSelectElement"]);
}
}
return this.canRenderAfterInputOrSelectElement;
}
}
--------------------------------
The second program: genProps.pl does this in batch.
I was wondering if anybody may need this - will need to customize for
individual case though (obviously), but philosophy remains same - it saves a
lot of time over even copy-paste-edit. Do you think it is good enough to be
put in mcs/tools?
Happy Hacking,
Gaurav
http://mastergaurav.virtualave.net/iitk
---------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MakeProps.pl
Type: application/x-perl
Size: 927 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20030405/5289e5c2/attachment.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: genProps.pl
Type: application/x-perl
Size: 276 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20030405/5289e5c2/attachment-0001.bin
More information about the Mono-devel-list
mailing list