Reading Array Values using EnvDTE.GetExpression
Hi,
When i tried to read the byte array using EnvDTE.GetExpression as below using the Expression.Item() function it is too slow
EnvDTE.Expression byteExprmn=EnvDTE.Expression .GetExpression("ByteArrayName",true,5)
EnvDTE.Expressions byteData=byteExprmn.DataMembers;
I am retrieving each element of the array using Item function
byte[] retArray=new byte[byteExprmn.DataMembers.Count];
for(int i=1;i<=retArray.Length;i++)
{retArray[i]= Convert.ToByte(byteData.Item(i));
}Is there any alternative way to get Arrays from Expressions Because this method is too slow.
Please let me know is anything wrong in the above code.
Thanks in Advance.
All Replies
- Hi Vicky,
I think the way you use to read Array Values using EnvDTE.GetExpression is good. But there is a error in your code, please replace
retArray[i]= Convert.ToByte(byteData.Item(i));
by
retArray[i]= Convert.ToByte(byteData.Item(i+1).Value);
And please refer this code which achieve the same function as yours, hope this helps.
EnvDTE.Expression byteExprmn = _applicationObject.Debugger.GetExpression("ByteArrayName", true, 100); EnvDTE.Expressions byteData = byteExprmn.DataMembers; byte[] retArray = new byte[byteExprmn.DataMembers.Count]; int pos=0; foreach(EnvDTE.Expression exp in byteData) { retArray[pos++] = Convert.ToByte(exp.Value); }
Please let me know if you have any questions.
Best Regards,
Nancy
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us. Hi Nancy,
Thanks for your reply. And sorry about the error it was a typing mistake.
When i tried with foreach instead of for loop to iterate array values i get the OutOfMemory Exception.
But if i use for loop i will not get any Exception. But the problem related with this is it is too slow
I am reading a byte array of size 524288.So, my question is there any alternate way to get array
values little faster from Debugger.
Thanks,- Hi Vicky,
Sorry for the delay.
Yes, I have tested if the array is large, it will be too slow. But in my opinion, if the array is too large, why don't you input these values to a file?
Best Regards,
Nancy
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us. Hi Nancy,
Thank you for your suggestion.Sorry this seems to be silly but how can i put these values to the file without reading them.
Can u please tell me how to do it. Actuallly the array contains the pixel values of the image
by reading the array values i need to recreate the image.
So, My question is IS There any other way of reading array value from debugger Expression.Item()?
Can i read any any variable values in AddIn from current solution? so that i can read array from solution directly?
Thanks in Advance,
Vicky


