Hi @Pankaj tripathi , Welcome to Microsoft Q&A,
The first warning (warning) is a prompt of naming conflict or hidden members in the programming language of C#(CSHARP). Specifically, this warning is to say that there is a class in your code (probably CustomdatagridView) defines a member called selectdColumns, but this member and the inherited base class inherited by this category (Maybe it is datagridView) The members of the same name have a conflict.
You can choose to use adding NEW keywords to clearly indicate that you intentionally hide members in the base class, or choose to modify it to other non -heavy names(Selected_Columns).
public new List<string> SelectedColumns
{
get { return selectedColumns; }
set { selectedColumns = value; }
}
The second error is also the usage of (if ... is ... x), which is temporarily named X. Two if (Context.Instance is CustomdatagridView CustomdatagridView) in the same scope, that is, in the same code block, you have defined a local variable called CustomDataGridView. In C#, the role of variables is usually defined by parentheses {}.
To solve this problem, you can consider changing the variable names in the first IF statement to different names to avoid conflicting with variable names in the second IF statement block. You can't define it to it.
Best Regards,
Jiale
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.