Skip to content

Instantly share code, notes, and snippets.

using System;
namespace A
{
interface IA{
string foo();
}
interface IB{
string foo();
@podhmo
podhmo / gist:8876454
Created February 8, 2014 03:54
interfaceの明示的な実装でframework?が提供する邪魔なコードを避けて呼ぶことができそうだけれど。間接的な呼び出しには対応していないし。
using System;
namespace PartialClassInterface
{
//It's ok
interface IFoo{
void foo();
}
@podhmo
podhmo / gist:8876590
Created February 8, 2014 04:11
get,setを持つpropertyを要求するinterfaceに対してgetだけしか実装では用意したくないというような時にはインターフェイスの明示的な実装で避けれるけれどバッドノウハウ的
using System;
namespace GetOnlyCollection
{
public interface IDictLike<T>{
T this [int i] { get; set;}
}
/*
public class GetOnlyNums : IDictLike<int>{
@podhmo
podhmo / gist:8877174
Created February 8, 2014 05:41
foreachの使い方まとめ。 ついでにIEnumerable<T>を実装してみた。
using System;
using System.Collections;
using System.Collections.Generic;
namespace ForEachSample
{
class MainClass
{
public static void Main (string[] args)
{
@podhmo
podhmo / gist:8877429
Created February 8, 2014 06:16
どうせなので自分でcollection型っぽいものを作ってIEnumerable<T>実装した。
using System;
using System.Collections.Generic;
using System.Collections;
namespace TreeEachSample
{
public class Tree<T>
{
public Tree<T> Left { get; set; }
@podhmo
podhmo / gist:8877952
Created February 8, 2014 07:26
linqつかうだけ
using System;
using System.Linq;
namespace LinqSample
{
class MainClass
{
public static void Main (string[] args)
{
Console.WriteLine ("Hello World!");
<FixedDocument xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<PageContent>
<FixedPage Width="744.09448819" Height="1052.3622047">
<Canvas>
<TextBlock TextWrapping="WrapWithOverflow" Width="494.28571" Height="217.14285" Canvas.Left="105.71429" Canvas.Top="383.79074" FontSize="40px" FontFamily="Sans" FontStyle="Normal" FontWeight="Normal">aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</TextBlock>
</Canvas>
</FixedPage>
</PageContent>
</FixedDocument>
<FixedDocument xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<PageContent>
<FixedPage Width="744.09448819" Height="1052.3622047">
<Canvas>
<TextBlock TextWrapping="Wrap" Width="545.71429" Height="265.71426" Canvas.Left="105.71429" Canvas.Top="383.79074" FontSize="40px" FontFamily="MS PGothic" FontStyle="Normal" FontWeight="Normal">aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</TextBlock>
<TextBlock TextWrapping="Wrap" Width="545.71429" Height="265.71426" Canvas.Left="105.71429" Canvas.Top="383.79074" FontSize="40px" FontFamily="MS PGothic" FontStyle="Normal" FontWeight="Normal">bbb</TextBlock>
<TextBlock TextWrapping="Wrap" Width="545.71429" Height="265.71426" Canvas.Left="105.71429" Canvas.Top="383.79074" FontSize="40px" FontFamily="MS PGothic" FontStyle="Normal" FontWeight="Normal">c</TextBlock>
</Canvas>
</FixedPage>
</PageContent>
<FixedDocument xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<PageContent>
<FixedPage Width="612pt" Height="792pt">
<Canvas>
<TextBlock Canvas.Left="146.64453" Canvas.Top="399.12387" FontSize="40px" FontFamily="Sans" Foreground="#000000" FontStyle="Normal" FontWeight="Normal">aaaaaaaaaaaaaaaaaaa </TextBlock>
<TextBlock Canvas.Left="146.64453" Canvas.Top="449.12387" FontSize="40px" FontFamily="Sans" Foreground="#000000" FontStyle="Normal" FontWeight="Normal">bb<Span FontSize="40px" FontFamily="Sans" Foreground="#ff0000" FontStyle="Normal" FontWeight="Normal">bbbbb</Span><Span FontSize="40px" FontFamily="Sans" Foreground="#008000" FontStyle="Normal" FontWeight="Normal">bb</Span><Span FontSize="40px" FontFamily="Sans" Foreground="#0000ff" FontStyle="Normal" FontWeight="Normal">bb</Span></TextBlock>
<TextBlock Canvas.Left="146.64453" Canvas.Top="499.12387" FontSize="40px" FontFamily="Sans" Foreground="#
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"