C
Christopher
Hi all,
I am trying to store a reference to a variable in my data
providerr class
but cannot save a reference to it. Can anyone help me?
I would like this code to allow me to store any field by
referenece so that
it's contents can be written to using the Value property.
Code sample:
============
public class MyField
{
private string strFieldName;
private object objValue;
public string FieldName {set{strFieldName=value;}get
{return(strFieldName);}}
public object Value {set{objValue=value;}get{return
(objValue);}}
public SqlField(string pFieldName,
ref object pObject) /* THIS LINE DOES NOT WORK AT
POINT REF */
{
strFieldName=pFieldName;
objValue=pObject;
}
Then in the program it is called using:
=======================================
int y=0;
MyField m = new MyField("id", ref y);
y=26;
Results wanted:
===============
m.Value is 0,
m.Value is 26 when y is set to 26
Please note that I don't always want to store an integer,
it maybe a string
or other object.
Thanks in advance
Chris
I am trying to store a reference to a variable in my data
providerr class
but cannot save a reference to it. Can anyone help me?
I would like this code to allow me to store any field by
referenece so that
it's contents can be written to using the Value property.
Code sample:
============
public class MyField
{
private string strFieldName;
private object objValue;
public string FieldName {set{strFieldName=value;}get
{return(strFieldName);}}
public object Value {set{objValue=value;}get{return
(objValue);}}
public SqlField(string pFieldName,
ref object pObject) /* THIS LINE DOES NOT WORK AT
POINT REF */
{
strFieldName=pFieldName;
objValue=pObject;
}
Then in the program it is called using:
=======================================
int y=0;
MyField m = new MyField("id", ref y);
y=26;
Results wanted:
===============
m.Value is 0,
m.Value is 26 when y is set to 26
Please note that I don't always want to store an integer,
it maybe a string
or other object.
Thanks in advance
Chris