我们可以加入nasted功能吗? [英] Can we difined nasted function ?

查看:140
本文介绍了我们可以加入nasted功能吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleExample
{
    class Example
    {
        public void a()
        {
            public void b()
        {
            public void c()
        {
            Console.WriteLine("abc");
        }
    }
    static void Main(string[] args)
    {
    Example obj = new Example();
    obj.a();  
     }
   
}





我尝试过:



什么是输出如果我定义了一个类并且在类的内部我定义了一个方法a()。在()中,我定义了另一个命名为b()的方法。在b()里面我又定义了一个方法c()。在c()里面我拿了一个语句......所以如果我创建了类的实例并调用了方法a();那么输出将是什么?



What I have tried:

what is the Output if i defined a class and inside of the class i defined a method a() . Inside a() i defined one more method naming as b(). and inside b() i defined one more method c(). and inside of c() i took one statement...so that if i created instance of the class and called method a();then what is the output will come

推荐答案

您可以在C#7.0中,但不能在之前的版本中:本地功能(C#编程指南)| Microsoft Docs [ ^ ]
You can in C# 7.0, but not in versions before that: Local functions (C# Programming Guide) | Microsoft Docs[^]


这篇关于我们可以加入nasted功能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆