axWindowMediaPlayer.settings.autoStart=false;
settings是播放器的一个属性,但是这个属性下面还可以有方法和属性,是怎么定义的.
我尝试如下来做,但是失败了.
新手,求指点.{:soso__1039173773029404865_2:}
- class settings
- {
- public void Say()
- {
- Console.WriteLine("Say something");
- }
- public bool IsEnabled
- {
- get
- {
- return false;
- }
- set
- {
- }
- }
- }
- class fortest
- {
- public settings settings
- {
- set
- {
- }
- get
- {
- return null;
- }
- }
- }
- class Program
- {
- static void Main(string[] args)
- {//试图通过属性来执行函数,但是因为类没有被实例化,函数执行失败.
- fortest mytest = new fortest();
- mytest.settings.Say();
- Console.WriteLine(mytest.settings.IsEnabled.ToString());
- Console.ReadKey();
- }
- }
复制代码
|
|