L
Lloyd Dupont
I have an object which is just a thin wrapper over an other object and might
be created in big quantities.
something like that:
// ===== pseudo-code cample =======
class TheObject
{
int[] data;
TheWrapper Data { get { return new TheWrapper(data); } }
}
class or struct TheWrapper
{
int[] data;
public TheWrapper(int[] data)
{
this.data = data;
}
public int Length { get { return data.Length; } }
public int this[int index] { get { return data[index]; } }
public int UtiliyOneLikeSearch() {}
//... etc ...
}
// ========= end of pseudo-code sample ==========
Now it is very likely that aTheObject.Data would be called many times used
for a few lines and forgot.
I thought it might be much more efficient memory wise to make TheWrapper a
struct.
but somehow I feel it's quite unconventional.
what do you think?
be created in big quantities.
something like that:
// ===== pseudo-code cample =======
class TheObject
{
int[] data;
TheWrapper Data { get { return new TheWrapper(data); } }
}
class or struct TheWrapper
{
int[] data;
public TheWrapper(int[] data)
{
this.data = data;
}
public int Length { get { return data.Length; } }
public int this[int index] { get { return data[index]; } }
public int UtiliyOneLikeSearch() {}
//... etc ...
}
// ========= end of pseudo-code sample ==========
Now it is very likely that aTheObject.Data would be called many times used
for a few lines and forgot.
I thought it might be much more efficient memory wise to make TheWrapper a
struct.
but somehow I feel it's quite unconventional.
what do you think?