Skip to content

Instantly share code, notes, and snippets.

@s2kw
s2kw / QueryTest.cs
Last active January 4, 2016 11:59
クエリ式を書いてみた。
using System;
using System.Linq;
namespace ConsoleApplication
{
class Program{
public enum Job{
knight,magician,axman,archer,witch,swordman,
}
static void Main (string[] args) {
var persons = new []{
@s2kw
s2kw / InheritedMember.cs
Last active August 29, 2015 13:55
継承の時はメンバの初期化に注意。
using System;
using System.Text;
static void Main (string[] args)
{
StringBuilder sb = new StringBuilder ();
B b = new B ();
sb.AppendLine ("B:" + b.NAME);
sb.AppendLine ("A:" + (new SomethingA(b)).str);
D d = new D ();
@s2kw
s2kw / Program.cs
Created February 17, 2014 13:07
継承したメンバーはどう見えるかとか。
using System;
using System.Text;
using System.Linq;
using System.Collections.Generic;
class Program{
public class A{
protected string member = "class a's member";
public virtual string method_a(){
return "class A method a\t" + this.member;
@s2kw
s2kw / link.md
Created February 19, 2014 06:50
@s2kw
s2kw / LinqVSForeach.cs
Last active August 29, 2015 13:56
WhereFirst vs First vs foreach
using System;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading;
namespace ConsoleApplication
{
class Program{
@s2kw
s2kw / ImportSettingFormatter.cs
Created March 3, 2014 04:32
画像のImport時の設定を自動化する例。
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
public class ImportSettingFormatter{
[MenuItem("Tools/TextureFormat")]
public static void Format()
{
@s2kw
s2kw / Anbasand.cs
Last active August 29, 2015 13:57
ビット演算子分からん病
class Program{
static void Main(string[] args)
{
Console.WriteLine ("\n&&&&&&&&&");
for (int i = 0; i < 10; i++)
for (int j = 0; j < 10; j++)
Console.WriteLine (string.Format("{0} & {1} = {2}",i,j,i&j));
Console.WriteLine ("\n|||||||||");
for (int i = 0; i < 10; i++)
@s2kw
s2kw / TouchParticleController.cs
Last active August 29, 2015 14:03
Unityのタッチしたらエフェクト出すコンポーネント。
using UnityEngine;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
public class TouchParticleController : MonoBehaviour {
public enum TouchState{
Touch,Untouch
}
@s2kw
s2kw / Singleton.cs
Created October 14, 2014 03:06
singleton 1
using UnityEngine;
using System.Collections;
public class Singleton<T> : MonoBehaviour where T : MonoBehaviour
{
protected static T instance;
public static T Instance
{
get
{
using System;
using System.Linq;
namespace PlayGrournd
{
class MainClass
{
public static void Main(){
var line = System.Console.ReadLine().Trim();
string[] words = line.Split(' ');