所有的鸟儿他们都知道, 他们的巢应该筑在什么地方, 鸟儿知道自己该在什么地方筑巢, 那就意味着他们了解他们自己的使命。 我们身为万物之灵的人类, 怎么会不知道,连鸟儿都知道的道理呢?
利用System.Reflection实现php下的可变变量(Variable variables)
利用System.Reflection实现php下的可变变量(Variable variables)

利用System.Reflection实现php下的可变变量(Variable variables)

<?php
$a 
'hello';
$$a 'world';
echo "$a ${$a}";
echo "$a $hello";
?>

    public static string mystr = "this is mystr";

    public static void Main()
    {

        string readstr = Console.ReadLine();
        Type type = typeof(SamplesEncoding);
        FieldInfo fi = type.GetField(readstr);
        if (fi != null)
            Console.WriteLine(fi.GetValue(null));
        else
            Console.WriteLine("donnot had this property: " + readstr);
        Console.Read();

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注