Hi.
Thanks your answer bad, standard reference isn't way.
I need reference over next class.
class ABase
{
SetValue(object dest)
{
dest = 10;
}
}
class A : ABase
{
int a;
B b = new B(ref a);
SetValue(b); // in this method i need set property a
// this way set only property mdest in class B
}
class B
{
int mdest;
B(ref int dest)
{
mdest = dest;
}
}
down is complete sample why i need ref over class.
class ABase
{
SetValueFromXX(string name,source,dest) // in C++ ( string name,source,
int *dest)
{
1. step
in source i find row with name
2. step
set value from source on finded row to dest, // in c++ *dest =
source.value
How can i do in safe c# - i need put value to property in class A
???
}
}
class A : ABase
{
int aa;
int ab;
int ac;
// and many next property
// Realy Count is About 100
public int Count = 3;
B b=new B(Count);
b[0] = new B( "power" , here need reference to aa); // in C++ &aa;
b[1] = new B( "volt" , here need reference to ab); // &ab
b[2] = new B( "aper", here need reference to ac); // &ac
ReadData()
{
1. step
read Data from something .... to source object
2. step
set data from source to property over base class ABase
for(i=0;i<Count;i++)
SetValueFromXX(b[i].mName, source ,b[i].mS_A_R);
// this don't work and it is problem in c#. When i use ref
i can put data only in class B
// i need put data to property aa,ab,ac in this class.
}
}
class B
{
B(string name, ??? S_A_R) // in c++ (string name,int *refer);
{
mName = name;
mS_A_R = S_A_R; // in c++ mS_A_R = refer;
}
public string mName;
public something about reference ??? mS_A_R; // in c++ int
*mS_A_R;
}
"Jon Skeet" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Brendan Duffy <(E-Mail Removed)> wrote:
> > Things declared as class types will be passed by reference.
>
> No they won't. References will be passed by value, which is a different
> thing.
>
> See http://www.pobox.com/~skeet/csharp/parameters.html
>
> --
> Jon Skeet - <(E-Mail Removed)>
> http://www.pobox.com/~skeet/
> If replying to the group, please do not mail me too