美文网首页
{C#} C#6酷酷的

{C#} C#6酷酷的

作者: windflow | 来源:发表于2016-06-17 10:15 被阅读0次
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GrammaOfCS6
{
    class Functions
    {
       public DateTime InitTime { get; } = DateTime.Now;

       public string TypeOfIt => string.Format("{0}", typeof(Functions));

       public int GetMax(int left, int right) => Math.Max(left, right);

       public int GetMin(int left, int right) => Math.Min(left, right);

       public string GetFirstName(string fullname)
       {
           return fullname?.Split(' ')[0];
       }

       public int? GetNameLength(string name)
       {
           return name?.Length;
       }

       public float AddNumber(float x, float y, Func<float, float, float> acc)
       {
           return acc?.Invoke(x, y) ?? (x + y);
       }

       public void PrintParam(string first, string second)
       {
           Console.WriteLine(string.Format("{0}:{1},{2}:{3}", nameof(first), first, nameof(second), second));
       }

       public void Introduce()
       {
           Console.WriteLine("you are calling {0}.{1}", nameof(Functions), nameof(Introduce));
       }

       public void WriteCMain()
       {
           var world = "world";
           var hello = $"hello, {world}";

           var cppHelloWorldProgram = new Dictionary<int, string>
           {
               [10] = $"{HeadOfCMain()}",
               [20] = "    printf(\"hello, world\")",
               [30] = "    return 0;}"
           };


           Console.WriteLine(cppHelloWorldProgram[10]);
           Console.WriteLine(cppHelloWorldProgram[20]);
           Console.WriteLine(cppHelloWorldProgram[30]);
       }

       private string HeadOfCMain()
       {
           return "int main() {";
       }
   }
}

相关文章

  • {C#} C#6酷酷的

  • 酷酷酷

    so cool 王师傅想不到的礼物 哈 还有个实用的充电宝 有点小期待 许愿歪脖香槟要好好喝

  • 测试

    酷酷酷

  • 亦哲生日快乐

    嘉蔚:祝超级无敌酷酷酷酷酷酷的一折生日快乐!!!!有啥事直接说,我们都是你的backup,每天开心才是最重要的!!...

  • 酷酷的👧🏻

    好久没画了 练练手

  • 酷酷的

    酷酷的,愿所有的生活美美的,愿在你心里的我酷酷的

  • 酷酷的

    闹铃声中醒来 迷迷糊糊穿衣洗漱 难免犯困,难免疲惫 但想到又有新的经历和遇见 起床气也冒着快乐的泡泡 一个女人最酷...

  • 2018-05-27

    心情不好的时候 喜欢听酷酷的歌 酷酷的电音 假装自己是个酷酷的人 生活丝毫不能影响酷酷的我 本尊高冷

  • 头像

    微信头像,酷酷的,自己比较喜欢酷酷的东西

  • 酷酷妈

    以后的以后,我家的儿子就叫酷酷,我就是酷酷妈

网友评论

      本文标题:{C#} C#6酷酷的

      本文链接:https://www.haomeiwen.com/subject/bkhvdttx.html