• Tuple类


    一:在.net4.0之前,我们需要一个方法返回多个参数,通常用以下几种方式:

      1、全局变量

      2、out 、 ref 变量

      3、定义类或结构体,把需要反回参数封装成属性

    二:.net4.0新增的Tuple类,可以方便的解决这个问题:

          Tuple类,它代表一个有序的N元组。所谓元组,其实就是“数值对”,比如以下就是一个4元组:(1,2.1,"stringTest",new object()),可以调用Tuple.Create静态方法或使用new 关键字直接创建一个Tuple对象。  .net 类库中定义了拥有1-7个泛型参数的泛型Tuple.使用Tuple对象作为方法返回值,可以很容易地包含多个结果.

     例:

    var tupleOne = new Tuple<int, string>(1, "Hello World"); 

    Console.WriteLine("Tuple contains: " + tupleOne.Item1 + " and " + tupleOne.Item2);

    var tupleTwo = Tuple.Create("Hello World", 2010); 
    var tupleThree = Tuple.Create("Hello World", 2010, new SomeClass()); 
    Console.WriteLine("Tuple contains: " + tupleThree.Item1 + ", " + tupleThree.Item2 + " and " + tupleThree.Item3.MyProperty);

  • 相关阅读:
    attention 介绍
    卷积神经网络中的channel 和filter
    滤波和卷积
    最容易理解的对卷积(convolution)的解释
    随机梯度下降
    optimizer
    一个深度学习的例子
    Batch_Size 详解
    softmax函数详解
    Must Know Tips/Tricks in Deep Neural Networks
  • 原文地址:https://www.cnblogs.com/mumuyu/p/3356169.html
Copyright © 2020-2023  润新知