[Mono-list] CopyFrom

Gaurav Vaish my_scripts2001@yahoo.com
Thu, 20 Sep 2001 01:55:41 +0530


Hello,
    Any ideas as to how to implement "CopyFrom(...)" function in
System.Web.UI.WebControls.FontInfo?

    What I thought of it to use relection to get get_* functions and then
use set_* functions to set the properties for the local object since "this =
fromObject" was not working. It said this is not allowed since the field is
read-only.

Quote:
FontInfo.cs(149,4): error CS1604: Cannot assign to '<this>' because it is
read-only
:Unquote

    Setting each and every property one by one looks like very inefficient.
It looks very ugly and pathetic to do something like:
    this.bold = fromObj.Bold;
    this.... = that....


Happy Hacking!

--------------------------------------------
Gaurav Vaish,
Student (4th Year)
Room F-303, Hall 1,
Department of Electrical Engineering
Indian Institute of Technology,
Kanpur, INDIA - 208016
--------------------------------------------