Created
November 29, 2011 08:53
-
-
Save masaru-b-cl/1404069 to your computer and use it in GitHub Desktop.
ConditionalActionConsoleApplication
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bin/ | |
obj/ | |
*.suo | |
*.user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Reflection; | |
using System.Runtime.CompilerServices; | |
using System.Runtime.InteropServices; | |
// アセンブリに関する一般情報は以下の属性セットをとおして制御されます。 | |
// アセンブリに関連付けられている情報を変更するには、 | |
// これらの属性値を変更してください。 | |
[assembly: AssemblyTitle("ConditionalActionConsoleApplication")] | |
[assembly: AssemblyDescription("")] | |
[assembly: AssemblyConfiguration("")] | |
[assembly: AssemblyCompany("")] | |
[assembly: AssemblyProduct("ConditionalActionConsoleApplication")] | |
[assembly: AssemblyCopyright("Copyright © 2011")] | |
[assembly: AssemblyTrademark("")] | |
[assembly: AssemblyCulture("")] | |
// ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから | |
// 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、 | |
// その型の ComVisible 属性を true に設定してください。 | |
[assembly: ComVisible(false)] | |
// 次の GUID は、このプロジェクトが COM に公開される場合の、typelib の ID です | |
[assembly: Guid("3be99304-911e-4638-a191-0e6fc7b577b2")] | |
// アセンブリのバージョン情報は、以下の 4 つの値で構成されています: | |
// | |
// Major Version | |
// Minor Version | |
// Build Number | |
// Revision | |
// | |
// すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を | |
// 既定値にすることができます: | |
// [assembly: AssemblyVersion("1.0.*")] | |
[assembly: AssemblyVersion("1.0.0.0")] | |
[assembly: AssemblyFileVersion("1.0.0.0")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<PropertyGroup> | |
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | |
<Platform Condition=" '$(Platform)' == '' ">x86</Platform> | |
<ProductVersion>8.0.30703</ProductVersion> | |
<SchemaVersion>2.0</SchemaVersion> | |
<ProjectGuid>{5ED937C7-6B92-4118-82CC-369F53FF01CD}</ProjectGuid> | |
<OutputType>Exe</OutputType> | |
<AppDesignerFolder>Properties</AppDesignerFolder> | |
<RootNamespace>ConditionalActionConsoleApplication</RootNamespace> | |
<AssemblyName>ConditionalActionConsoleApplication</AssemblyName> | |
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> | |
<TargetFrameworkProfile>Client</TargetFrameworkProfile> | |
<FileAlignment>512</FileAlignment> | |
</PropertyGroup> | |
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> | |
<PlatformTarget>x86</PlatformTarget> | |
<DebugSymbols>true</DebugSymbols> | |
<DebugType>full</DebugType> | |
<Optimize>false</Optimize> | |
<OutputPath>bin\Debug\</OutputPath> | |
<DefineConstants>DEBUG;TRACE</DefineConstants> | |
<ErrorReport>prompt</ErrorReport> | |
<WarningLevel>4</WarningLevel> | |
</PropertyGroup> | |
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> | |
<PlatformTarget>x86</PlatformTarget> | |
<DebugType>pdbonly</DebugType> | |
<Optimize>true</Optimize> | |
<OutputPath>bin\Release\</OutputPath> | |
<DefineConstants>TRACE</DefineConstants> | |
<ErrorReport>prompt</ErrorReport> | |
<WarningLevel>4</WarningLevel> | |
</PropertyGroup> | |
<ItemGroup> | |
<Reference Include="System" /> | |
<Reference Include="System.Core" /> | |
<Reference Include="System.Xml.Linq" /> | |
<Reference Include="System.Data.DataSetExtensions" /> | |
<Reference Include="Microsoft.CSharp" /> | |
<Reference Include="System.Data" /> | |
<Reference Include="System.Xml" /> | |
</ItemGroup> | |
<ItemGroup> | |
<Compile Include="Program.cs" /> | |
<Compile Include="Properties\AssemblyInfo.cs" /> | |
</ItemGroup> | |
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | |
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | |
Other similar extension points exist, see Microsoft.Common.targets. | |
<Target Name="BeforeBuild"> | |
</Target> | |
<Target Name="AfterBuild"> | |
</Target> | |
--> | |
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| |
Microsoft Visual Studio Solution File, Format Version 11.00 | |
# Visual Studio 2010 | |
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConditionalActionConsoleApplication", "ConditionalActionConsoleApplication.csproj", "{5ED937C7-6B92-4118-82CC-369F53FF01CD}" | |
EndProject | |
Global | |
GlobalSection(SolutionConfigurationPlatforms) = preSolution | |
Debug|x86 = Debug|x86 | |
Release|x86 = Release|x86 | |
EndGlobalSection | |
GlobalSection(ProjectConfigurationPlatforms) = postSolution | |
{5ED937C7-6B92-4118-82CC-369F53FF01CD}.Debug|x86.ActiveCfg = Debug|x86 | |
{5ED937C7-6B92-4118-82CC-369F53FF01CD}.Debug|x86.Build.0 = Debug|x86 | |
{5ED937C7-6B92-4118-82CC-369F53FF01CD}.Release|x86.ActiveCfg = Release|x86 | |
{5ED937C7-6B92-4118-82CC-369F53FF01CD}.Release|x86.Build.0 = Release|x86 | |
EndGlobalSection | |
GlobalSection(SolutionProperties) = preSolution | |
HideSolutionNode = FALSE | |
EndGlobalSection | |
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
using System.Collections.Generic; | |
namespace ConditionalActionConsoleApplication | |
{ | |
public static class EnumerableEx | |
{ | |
public static IEnumerable<TSource> Do<TSource>(this IEnumerable<TSource> source, Action<TSource> onNext) | |
{ | |
foreach (var item in source) | |
{ | |
onNext(item); | |
yield return item; | |
} | |
} | |
} | |
public class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
Enumerable.Range(1, 20) | |
.Do(n => | |
{ | |
if (n % 3 == 0 && n % 5 == 0) | |
{ | |
Console.WriteLine("FizzBuzz"); | |
} | |
}) | |
.Do(n => | |
{ | |
if (n % 3 == 0) | |
{ | |
Console.WriteLine("Fizz"); | |
} | |
}) | |
.Do(n => | |
{ | |
if (n % 5 == 0) | |
{ | |
Console.WriteLine("Buzz"); | |
} | |
}) | |
.Do(n => | |
{ | |
if (n % 3 != 0 && n % 5 != 0) | |
{ | |
Console.WriteLine(n); | |
} | |
}) | |
.All(_ => true); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment