Quickwatch to C# code conversion

问题内容:

I had to find a value with the quickwatch and this is what I got out of it:

((System.Web.UI.WebControls.TextBox)(new System.Linq.SystemCore_EnumerableDebugView(GvAllCustomers.SelectedRow.Cells[1].Controls).Items[0])).Text

GvAllCustomers is my gridview

The problem is, when I add this to my code it shows errors.

string sC_Name = ((System.Web.UI.WebControls.TextBox)(new System.Linq.SystemCore_EnumerableDebugView(GvAllCustomers.SelectedRow.Cells[1].Controls).Items[0])).Text;

Error CS0234: The type or namespace name ‘SystemCore_EnumerableDebugView’ does not exist in the namespace ‘System.Linq’ (are you missing an assembly reference?)

I get that SystemCore_EnumerableDebugView isn’t in System.Linq. But what should I replace it with?

问题评论:

2  
Didn´t a google-search help: this for example: codeproject.com/Questions/1076903/… or also this stackoverflow.com/questions/38073790/…

答案:

答案1:

you are not supposed to use internal framework classes, rather rely on the public api…

var textbox = grid.SelectedRow.Cells[1].Controls[0] as TextBox;

答案评论:

原文地址:

https://stackoverflow.com/questions/47749027/quickwatch-to-c-sharp-code-conversion

Tags:, ,

添加评论

友情链接:蝴蝶教程