由于其保护级别,MainWindow Vbox 无法访问

编程入门 行业动态 更新时间:2024-10-26 15:30:40
本文介绍了由于其保护级别,MainWindow Vbox 无法访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在使用 Monodevelop 制作一个 gtk#2 应用程序.

I am making a gtk# 2 application using Monodevelop.

我制作了一个简单的 GUI,将一个 Window 和一个 Vbox 作为它的子项,以便在运行时使用它并在以后添加更多内容.

I have made a simple GUI, with a Window and a Vbox as its child in order to use it from the runtime and add more stuff later on.

似乎我无法从代码访问 vbox.

It seems though that i cannot access the vbox from the code.

这是代码:

namespace test { class MainClass { public static void Main (string[] args) { Application.Init (); MainWindow win = new MainWindow (); TreeView tree = new TreeView (); Console.WriteLine(win.Child.Name); Mainvbox=win.vbox2; ... }}}

我得到的错误是这样的:错误 CS0122:MainWindow.vbox2"由于其保护级别(CS0122)(测试)而无法访问

The error i get is this: Error CS0122: `MainWindow.vbox2' is inaccessible due to its protection level (CS0122) (test)

推荐答案

vbox2 可能是私有/受保护的,编写一个属性访问器以在 MainWindow 的类中返回它(或在 MainWindow 代码中访问它).

vbox2 may be private/protected, write a property accessor to return it in MainWindow's class (or access it within MainWindow code).

更多推荐

由于其保护级别,MainWindow Vbox 无法访问

本文发布于:2023-11-26 19:58:35,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1634977.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:于其   无法访问   级别   MainWindow   Vbox

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!