Home > Net >  Object to the List, the breakpoint monitoring values, practical operation is=null, is this why
Object to the List, the breakpoint monitoring values, practical operation is=null, is this why

Time:12-28

 
[TestMethod ()]
Public void turn the Object List test ()
{
List Test=new List {1, 2, 3, 4, 6};
Var obj=(object) test;
//run the List=null, surveillance, the breakpoint (obj as IEnumerable) There are values
Var list=obj as IEnumerable;
}

Can see from the photos, after the assignment of the List is null.
But the breakpoint monitoring, obj as IEnumerable Have value,,,
This is why ah,,

CodePudding user response:

May be a local variable life cycle
  •  Tags:  
  • C#
  • Related