G
Guest
I received this error when I used "ref" in foreach statement.
Dictionary<string, object> oInterfaces;
foreach (clsInterface vinterface in oInterfaces.Values)
{
func1( ref vinterface );
}
Error: Cannot pass 'vinterface' as a ref or out argument because it is a
'foreach iteration variable'
I tried to use for statement but it's seem that "vinterface =
oInterfaces[0];" isn't correct. Because the index "i" isn't a key.
for (int i = 0; i < oInterfaces.Count; i++)
{
vinterface = oInterfaces;
func1( ref vinterface );
}
Any ideas?
thanks,
ano
Dictionary<string, object> oInterfaces;
foreach (clsInterface vinterface in oInterfaces.Values)
{
func1( ref vinterface );
}
Error: Cannot pass 'vinterface' as a ref or out argument because it is a
'foreach iteration variable'
I tried to use for statement but it's seem that "vinterface =
oInterfaces[0];" isn't correct. Because the index "i" isn't a key.
for (int i = 0; i < oInterfaces.Count; i++)
{
vinterface = oInterfaces;
func1( ref vinterface );
}
Any ideas?
thanks,
ano