• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 253
  • Last Modified:

[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]

Why cant I do this on a normal Generic List ?
Im getting an error..
Error      1      Only assignment, call, increment, decrement, and new object expressions can be used as a statement      
//[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
            List<string> GetData = new List<string>();

Open in new window

0
u2envy1
Asked:
u2envy1
  • 3
  • 2
1 Solution
 
käµfm³d 👽Commented:
Are you sure this line is the one giving error? I copied into a project and it seemed to work fine.
0
 
u2envy1Author Commented:
Yip, if I comment the line out I get no error......
I should only be using this namespace ? using System.Diagnostics;
0
 
käµfm³d 👽Commented:
If possible, can you post some additional code? It would be helpful to see the context you are using this in. I can't seem to reproduce your issue.
0
 
käµfm³d 👽Commented:
If you are trying to use it within a function, you may have issues. I believe this attribute is intended to attach to class members.

http://msdn.microsoft.com/en-us/library/system.diagnostics.debuggerbrowsableattribute.aspx
// Will work
 
public class Class1
{
    // Will work
    [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
    private string Member1;
 
    public void SomeFunction()
    {
        // Will not work
        [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
        string LocalVar1;
    }
}

Open in new window

0
 
u2envy1Author Commented:
Thx, I was using it in a method....
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now