第七次作业

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


namespace ConsoleApplication9
{}
class Program
{
Book book;
FootBall football;

static void Main(string[] args)
{

FieldInfo[] fi = typeof(Program).GetFields(BindingFlags.NonPublic | BindingFlags.Instance);
for (int i = 0; i < fi.Length; i++)
{
object[] obj = fi[i].FieldType.GetCustomAttributes(typeof(PlayAttribute), false);
if (obj != null && obj.Length > 0)
{
Console.WriteLine("Name:{0} Type:{1}", fi[i].Name, fi[i].FieldType);
}
}

Console.Read();
}
}
public class PlayAttribute : Attribute
{
}
[Play]
public class Book { }
public class FootBall { }

 

 

<Window x:Class="WpfApplication1.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="300" Width="300">
    <Grid>
        <Grid.Background>
            <LinearGradientBrush>
                <GradientStop Offset="0" Color="Blue"></GradientStop>
                <GradientStop Offset="0.5" Color="LightBlue"></GradientStop>
            </LinearGradientBrush>
        </Grid.Background>
        <TextBox Height="23" Margin="10,10,10,0" Name="textBox1" VerticalAlignment="Top" Text="{Binding ElementName=slider1, Path=Value, UpdateSourceTrigger=PropertyChanged}" />
        <Slider Height="21" Margin="10,40,10,0" Name="slider1" VerticalAlignment="Top" Maximum="100" />
    </Grid>
</Window>
posted @ 2015-05-04 09:15    阅读(82)  评论(0编辑  收藏  举报