Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

init checkin

  • Loading branch information...
commit 0ffcf23d1fb5e7d8590d44ff2619e45f5c17a65b 1 parent 2168b0c
bnie authored
Showing with 5,488 additions and 0 deletions.
  1. +27 −0 ActionFunc.cs
  2. +91 −0 Aggregate.cs
  3. +42 −0 Extension.cs
  4. +27 −0 Lambda.cs
  5. +59 −0 MyDynamicProxy.cs
  6. +41 −0 OverrideEvent.cs
  7. +36 −0 Properties/AssemblyInfo.cs
  8. +30 −0 SOSDebugging.cs
  9. +122 −0 SingleTon.cs
  10. +48 −0 ThreadStatic.cs
  11. +46 −0 ThrowEx.cs
  12. BIN  bin/Debug/Castle.Core.dll
  13. +4,756 −0 bin/Debug/Castle.Core.xml
  14. BIN  bin/Debug/dotNetResearch.exe
  15. BIN  bin/Debug/dotNetResearch.pdb
  16. BIN  bin/Debug/dotNetResearch.vshost.exe
  17. +11 −0 bin/Debug/dotNetResearch.vshost.exe.manifest
  18. BIN  bin/Release/dotNetResearch.exe
  19. BIN  bin/Release/dotNetResearch.pdb
  20. BIN  bin/Release/dotNetResearch.vshost.exe
  21. +11 −0 bin/Release/dotNetResearch.vshost.exe.manifest
  22. +81 −0 dotNetResearch.csproj
  23. +6 −0 dotNetResearch.csproj.user
  24. BIN  obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache
  25. BIN  obj/x86/Debug/ResolveAssemblyReference.cache
  26. +12 −0 obj/x86/Debug/dotNetResearch.csproj.FileListAbsolute.txt
  27. BIN  obj/x86/Debug/dotNetResearch.exe
  28. BIN  obj/x86/Debug/dotNetResearch.pdb
  29. BIN  obj/x86/Release/DesignTimeResolveAssemblyReferencesInput.cache
  30. +5 −0 obj/x86/Release/dotNetResearch.csproj.FileListAbsolute.txt
  31. BIN  obj/x86/Release/dotNetResearch.exe
  32. BIN  obj/x86/Release/dotNetResearch.pdb
  33. +5 −0 packages.config
  34. +32 −0 yield.cs
View
27 ActionFunc.cs
@@ -0,0 +1,27 @@
+using System;
+
+public class Name
+{
+ private string instanceName;
+ public Name(string name)
+ {
+ this.instanceName = name;
+ }
+ public void DisplayToWindow()
+ {
+ Console.WriteLine(this.instanceName);
+ }
+}
+
+public class testTestDelegate
+{
+ //public static void Main()
+ //{
+ // Name testName = new Name("Koani");
+ // //Action a = testName.DisplayToWindow;
+ // //a();
+ // Action a = () => testName.DisplayToWindow();
+ // a();
+
+ //}
+}
View
91 Aggregate.cs
@@ -0,0 +1,91 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+namespace GiftGis {
+ class Linq_Aggregate_Test_Class {
+ //static void Main(string[] args) {
+ // long x = 12345L;
+ // long bBB = 12345;
+ // if (x == bBB) { Console.Write("YES"); }
+ // String newline = Environment.NewLine;
+ // Double[] nums = new Double[] { 2, 4, 6, 8 };
+ // var strs = String.Join(",", (nums.Select<Double, String>(v => v.ToString())).ToArray());
+ // Console.ForegroundColor = ConsoleColor.Magenta;
+ // Console.WriteLine("Double数组:" + strs);
+ // Console.WriteLine("应用Aggregate方法,不同的参数形式下不同的结果");
+ // Console.ForegroundColor = ConsoleColor.Green;
+ // Console.WriteLine(newline + "a+b=" + nums.Aggregate((a, b) => a + b).ToString());
+ // Console.WriteLine("计算过程:2->2+4->6+6->12+8=20");
+ // Console.WriteLine(newline + "a/2+b=" + nums.Aggregate((a, b) => a / 2 + b).ToString());
+ // Console.WriteLine("计算过程:2/2->1->1+4->2.5+6->4.25+8=12.25");
+ // Console.ForegroundColor = ConsoleColor.Cyan;
+ // Console.WriteLine(newline + "14, (a, b) => a / 2 + b=" +
+ // nums.Aggregate(14.0, (a, b) => a / 2 + b).ToString());
+ // Console.WriteLine("计算过程:14/2+2>9/2 +4=8.5/2 +6>10.25/2+8 >13.125" + newline + "相当于数组前面加上了一元素:14");
+ // Console.WriteLine(newline + "a+b/2=" + nums.Aggregate((a, b) => a + b / 2).ToString());
+ // Console.WriteLine("2->2+4/2->4+6/2->7+8/2=11");
+ // Console.WriteLine(newline + "a*b=" + nums.Aggregate((a, b) => a * b).ToString());
+ // Console.WriteLine("计算过程:2->2*4->8*6->48*8=438");
+ // Console.ForegroundColor = ConsoleColor.Green;
+ // Console.WriteLine(newline + "下在MSDN网上的一个例子,\n这个例子是用户银行卡上有100RMB," +
+ // "现在他尝试取消,\n每次取款的数是一个数组,\n注意了:\n如果他尝试取款的数大于当前用户账号的余额," +
+ // "\n则是取不了款的,\n现在要求得用户最终账号的余额是多少");
+ // /*This sample uses Aggregate to create a
+ // * running account balance that subtracts each withdrawal
+ // * from the initial balance of 100,
+ // * as long as the balance never drops below 0*/
+ // Console.ForegroundColor = ConsoleColor.Yellow;
+ // double startBalance = 100.0;
+ // int[] attemptedWithdrawals = { 20, 10, 40, 50, 10, 70, 30 };
+ // Console.WriteLine(newline + "最初存款:{0}\n每次尝试取款的数目:{1}",
+ // startBalance, String.Join(",", attemptedWithdrawals.Select<Int32, String>(v => v.ToString())));
+ // Console.WriteLine(newline + "函数书写方式:\n" +
+ // "\ndouble endBalance =" +
+ // "\n attemptedWithdrawals.Aggregate(startBalance," +
+ // "\n(balance, nextWithdrawal) =>" +
+ // "\n((nextWithdrawal <= balance) ? (balance - nextWithdrawal) : balance));");
+ // double endBalance =
+ // attemptedWithdrawals.Aggregate(startBalance,
+ // (balance, nextWithdrawal) =>
+ // ((nextWithdrawal <= balance) ? (balance - nextWithdrawal) : balance));
+ // // endBalance= 20
+ // Console.WriteLine("Ending balance(最终余额): {0}", endBalance);
+ // Console.ForegroundColor = ConsoleColor.Cyan;
+ // Console.WriteLine(newline +
+ // "执行过程的人工分析\n" +
+ // "\n第1次取20RMB,剩余:80RMB" +
+ // "\n第2次取10RMB,剩余:70RMB" +
+ // "\n第3次取40RMB,剩余:30RMB" +
+ // "\n第4次取50RMB,无法取得,剩余30RMB" +
+ // "\n第5次取10RMB,剩余 20RMB" +
+ // "\n第6次取70RMB,取不了,剩余20RMB" +
+ // "\n第7次取30RMB,取不了,剩余20RMB" +
+ // "\n所以最后的结果是 20RMB");
+
+
+ // string[] names1 = { "Hartono, Tommy" };
+ // string[] names2 = { "Adams, Terry", "Andersen, Henriette Thaulow",
+ // "Hedlund, Magnus", "Ito, Shu" };
+ // string[] names3 = { "Solanki, Ajay", "Hoeing, Helge",
+ // "Andersen, Henriette Thaulow",
+ // "Potra, Cristina", "Iallo, Lucio" };
+
+ // List<string[]> namesList =
+ // new List<string[]> { names1, names2, names3 };
+
+ // // Only include arrays that have four or more elements
+ // IEnumerable<string> allNames =
+ // namesList.Aggregate(Enumerable.Empty<string>(),
+ // (current, next) => next.Length > 3 ? current.Union(next) : current);
+
+ // foreach (string name in allNames) {
+ // Console.Write( name + "\n");
+ // }
+
+ // Console.ResetColor();
+
+
+ //}
+ }
+}
View
42 Extension.cs
@@ -0,0 +1,42 @@
+using System;
+using System.Runtime.CompilerServices;
+using System.Reflection;
+using System.Linq;
+using System.Collections.Generic;
+
+
+
+namespace dotNetResearch {
+ public class Test {
+
+ static void Main() {
+ Assembly thisAssembly = typeof(Test).Assembly;
+ foreach (MethodInfo method in GetExtensionMethods(thisAssembly,
+ typeof(string))) {
+ Console.WriteLine(method);
+ }
+ }
+
+ static IEnumerable<MethodInfo> GetExtensionMethods(Assembly assembly,
+ Type extendedType) {
+ var query = from type in assembly.GetTypes()
+ where type.IsSealed && !type.IsGenericType && !type.IsNested
+ from method in type.GetMethods(BindingFlags.Static
+ | BindingFlags.Public | BindingFlags.NonPublic)
+ where method.IsDefined(typeof(ExtensionAttribute), false)
+ where method.GetParameters()[0].ParameterType == extendedType
+ select method;
+ return query;
+ }
+ }
+
+ public static class FirstExtensions {
+ public static void Foo(this string x) { }
+ public static void Bar(string x) { } // Not an ext. method
+ public static void Baz(this int x) { } // Not on string
+ }
+
+ public static class SecondExtensions {
+ public static void Quux(this string x) { }
+ }
+}
View
27 Lambda.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Linq.Expressions;
+
+namespace dotNetResearch {
+ delegate int del(int i);
+ class Lambda {
+ //static void Main(string[] args) {
+ // del myDelegate = x => x * x;
+ // int j = myDelegate(5); //j = 25
+ // Console.WriteLine(j);
+ //}
+ }
+
+ //class Program {
+ // static void Main(string[] args) {
+ // Expression<del> myET = x => x * x;
+ // }
+ //}
+}
+
+
+
+
+
View
59 MyDynamicProxy.cs
@@ -0,0 +1,59 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using Castle.Core;
+using Castle.DynamicProxy;
+
+namespace dotNetResearch {
+ class MyDynamicProxy {
+
+ public void Test() {
+ ProxyGenerator generator = new ProxyGenerator();
+ CallingLogInterceptor interceptor = new CallingLogInterceptor();
+ SimpleSamepleEntity entity = generator.CreateClassProxy<SimpleSamepleEntity>(interceptor);
+ entity.Name = "Richie";
+ entity.Age = 50;
+ Console.WriteLine("The entity is: " + entity);
+ Console.WriteLine("Type of the entity: " + entity.GetType().FullName);
+ Console.ReadKey();
+ }
+ }
+
+ public class SimpleSamepleEntity {
+ public virtual string Name { get; set; }
+ public virtual int Age { get; set; }
+ public override string ToString() {
+ return string.Format("{{ Name: \"{0}\", Age: {1} }}", this.Name, this.Age);
+ }
+ }
+
+ public class CallingLogInterceptor : IInterceptor {
+ private int _indent = 0;
+ private void PreProceed(IInvocation invocation) {
+ if (this._indent > 0)
+ Console.Write(" ".PadRight(this._indent * 4, ' '));
+ this._indent++;
+ Console.Write("Intercepting: " + invocation.Method.Name + "(");
+ if (invocation.Arguments != null && invocation.Arguments.Length > 0)
+ for (int i = 0; i < invocation.Arguments.Length; i++) {
+ if (i != 0) Console.Write(", ");
+ Console.Write(invocation.Arguments[i] == null
+ ? "null"
+ : invocation.Arguments[i].GetType() == typeof(string)
+ ? "\"" + invocation.Arguments[i].ToString() + "\""
+ : invocation.Arguments[i].ToString());
+ }
+ Console.WriteLine(")");
+ }
+ private void PostProceed(IInvocation invocation) {
+ this._indent--;
+ }
+ public void Intercept(IInvocation invocation) {
+ this.PreProceed(invocation);
+ invocation.Proceed();
+ this.PostProceed(invocation);
+ }
+ }
+}
View
41 OverrideEvent.cs
@@ -0,0 +1,41 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace dotNetResearch {
+ public class OverrideEvent {
+ //static void Main() {
+ // BaseClass bc = new BaseClass();
+
+ // bc.someEvent += new BaseClass.SomeEventHandle(bc_someEvent);
+ // bc.Run();
+
+ //}
+
+ static void bc_someEvent(object sender, EventArgs args) {
+ Console.Write("you input a");
+ }
+ }
+
+ public class BaseClass {
+ public delegate void SomeEventHandle(object sender, EventArgs args);
+
+ public event SomeEventHandle someEvent;
+
+ public void Run ()
+ {
+ while (true) {
+ if (Console.ReadLine() == "A") {
+ someEvent(null, new EventArgs());
+ }
+ }
+ }
+
+ }
+
+ public class SubClass : BaseClass {
+
+ }
+
+}
View
36 Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("dotNetResearch")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("dotNetResearch")]
+[assembly: AssemblyCopyright("Copyright © 2012")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("cefa3bd0-5ef8-4bb5-b2c0-5bc96e9cc5e4")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
View
30 SOSDebugging.cs
@@ -0,0 +1,30 @@
+using System;
+using System.Data;
+
+namespace dotNetResearch
+{
+ class Base
+ {
+ public virtual void Test() { }
+ }
+
+ class Derived : Base
+ {
+ public override void Test() { }
+ }
+
+ public class Program
+ {
+ //static void Main(string[] args)
+ //{
+ // Derived o = new Derived();
+ // o.Test();
+
+ // (o as Base).Test();
+
+ // Console.WriteLine("Press any key to exit...");
+ // Console.ReadKey(true);
+ // Environment.Exit(0);
+ //}
+ }
+}
View
122 SingleTon.cs
@@ -0,0 +1,122 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace dotNetResearch {
+
+ /// <summary>
+ /// Not thread-safe
+ ///
+ /// </summary>
+ public sealed class SingletonA {
+ static SingletonA instance = null;
+ SingletonA() {
+ }
+ public static SingletonA Instance {
+ get {
+ if (instance == null) {
+ instance = new SingletonA();
+ }
+ return instance;
+ }
+ }
+ }
+
+
+
+ /// <summary>
+ /// Simple thread-safety
+ /// </summary>
+ public sealed class SingletonB {
+ static SingletonB instance = null;
+ static readonly object padlock = new object();
+ SingletonB() {
+ }
+ public static SingletonB Instance {
+ get {
+ lock (padlock) {
+ if (instance == null) {
+ instance = new SingletonB();
+ }
+ return instance;
+ }
+ }
+ }
+ }
+
+ public sealed class Singleton3 {
+ static Singleton3 instance = null;
+ static readonly object padlock = new object();
+
+ Singleton3() {
+ }
+
+ public static Singleton3 Instance {
+ get {
+ if (instance == null) {
+ lock (padlock) {
+ if (instance == null) {
+ instance = new Singleton3();
+ }
+ }
+ }
+ return instance;
+ }
+ }
+ }
+
+ public sealed class Singleton4 {
+ static readonly Singleton4 instance = new Singleton4();
+
+ // Explicit static constructor to tell C# compiler
+ // not to mark type as beforefieldinit
+ static Singleton4() {
+ }
+
+ Singleton4() {
+ }
+
+ public static Singleton4 Instance {
+ get {
+ return instance;
+ }
+ }
+ }
+
+ public sealed class Singleton5 {
+ Singleton5() {
+ }
+
+ public static Singleton5 Instance {
+ get {
+ return Nested.instance;
+ }
+ }
+
+ class Nested {
+ // Explicit static constructor to tell C# compiler
+ // not to mark type as beforefieldinit
+ static Nested() {
+ }
+
+ internal static readonly Singleton5 instance = new Singleton5();
+ }
+ }
+
+ public class Bus {
+ // Static constructor:
+ static Bus() {
+ System.Console.WriteLine("The static constructor invoked.");
+ }
+ public static void Drive() {
+ System.Console.WriteLine("The Drive method invoked.");
+ }
+ }
+ //class TestBus {
+ // static void Main() {
+ // Bus.Drive();
+ // }
+ //}
+}
+
View
48 ThreadStatic.cs
@@ -0,0 +1,48 @@
+using System.Threading;
+namespace dotNetResearch
+{
+ /// <summary>
+ /// 默认情况下,一个静态字段被进程中所有线程共享
+ /// 对静态字体应用System.ThreadStatic,强迫CLR为进程中的每个线程创建该静态字段的实例
+ /// </summary>
+ class ThreadStatic
+ {
+ [System.ThreadStatic]
+ static string str = "InitValue";
+
+ static void DisplayStr()
+ {
+ System.Console.WriteLine("Thread{0}: {1}",
+ Thread.CurrentThread.ManagedThreadId,str);
+ }
+
+ static void ThreadProc()
+ {
+ DisplayStr();
+ str = "ThreadProc Value";
+ DisplayStr();
+ }
+
+ //static void Main(string[] args)
+ //{
+ // DisplayStr();
+ // Thread r = new Thread(ThreadProc);
+ // r.Start();
+ // r.Join();
+ // DisplayStr();
+ //}
+ }
+}
+/*********************
+ * 不使用System.ThreadStatic属性,则输出:
+ * Thread1: InitValue
+ * Thread3: InitValue
+ * Thread3: ThreadProc Value
+ * Thread1: ThreadProc Value
+ *
+ * 使用System.ThreadStatic属性,则输出:
+ * Thread1: InitValue
+ * Thread3:
+ * Thread3: ThreadProc Value
+ * Thread1: InitValue
+ * ******************/
View
46 ThrowEx.cs
@@ -0,0 +1,46 @@
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Diagnostics;
+
+namespace ThrowEx
+{
+ class Program
+ {
+
+ //static void Main(string[] args)
+ //{
+ // ThrowSample ts = new ThrowSample();
+ // try
+ // { ts.ThrowExMethod(); }
+ // catch (Exception ex)
+ // { Console.WriteLine(ex.ToString()); }
+ // Console.WriteLine("----------------------------------------------------------");
+ // try
+ // { ts.ThrowExMethod2(); }
+ // catch (Exception ex)
+ // { Console.WriteLine(ex.ToString()); }
+ // Console.ReadKey();
+ //}
+ }
+ class ThrowSample
+ {
+ private void ExceptionMethod() { throw new DivideByZeroException(); }
+ public void ThrowExMethod()
+ {
+ try
+ { this.ExceptionMethod(); }
+ catch (Exception ex)
+ { throw; }
+ }
+ public void ThrowExMethod2()
+ {
+ try
+ { this.ExceptionMethod(); }
+ catch (Exception ex)
+ { throw ex; }
+ }
+ }
+}
View
BIN  bin/Debug/Castle.Core.dll
Binary file not shown
View
4,756 bin/Debug/Castle.Core.xml
4,756 additions, 0 deletions not shown
View
BIN  bin/Debug/dotNetResearch.exe
Binary file not shown
View
BIN  bin/Debug/dotNetResearch.pdb
Binary file not shown
View
BIN  bin/Debug/dotNetResearch.vshost.exe
Binary file not shown
View
11 bin/Debug/dotNetResearch.vshost.exe.manifest
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+ <assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
+ <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
+ <security>
+ <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
+ <requestedExecutionLevel level="asInvoker" uiAccess="false"/>
+ </requestedPrivileges>
+ </security>
+ </trustInfo>
+</assembly>
View
BIN  bin/Release/dotNetResearch.exe
Binary file not shown
View
BIN  bin/Release/dotNetResearch.pdb
Binary file not shown
View
BIN  bin/Release/dotNetResearch.vshost.exe
Binary file not shown
View
11 bin/Release/dotNetResearch.vshost.exe.manifest
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+ <assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
+ <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
+ <security>
+ <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
+ <requestedExecutionLevel level="asInvoker" uiAccess="false"/>
+ </requestedPrivileges>
+ </security>
+ </trustInfo>
+</assembly>
View
81 dotNetResearch.csproj
@@ -0,0 +1,81 @@
+<?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>{F59443F2-BB57-40C6-A128-D8160AF5BA9B}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>dotNetResearch</RootNamespace>
+ <AssemblyName>dotNetResearch</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>
+ <PropertyGroup>
+ <StartupObject />
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="Castle.Core">
+ <HintPath>..\packages\Castle.Core.3.1.0\lib\net40-client\Castle.Core.dll</HintPath>
+ </Reference>
+ <Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <Private>True</Private>
+ <HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Web.ApplicationServices" />
+ <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="ActionFunc.cs" />
+ <Compile Include="Aggregate.cs" />
+ <Compile Include="Extension.cs" />
+ <Compile Include="MyDynamicProxy.cs" />
+ <Compile Include="Lambda.cs" />
+ <Compile Include="OverrideEvent.cs" />
+ <Compile Include="SingleTon.cs" />
+ <Compile Include="SOSDebugging.cs" />
+ <Compile Include="ThreadStatic.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="ThrowEx.cs" />
+ <Compile Include="yield.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="packages.config" />
+ </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>
View
6 dotNetResearch.csproj.user
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
+ <EnableUnmanagedDebugging>true</EnableUnmanagedDebugging>
+ </PropertyGroup>
+</Project>
View
BIN  obj/x86/Debug/DesignTimeResolveAssemblyReferencesInput.cache
Binary file not shown
View
BIN  obj/x86/Debug/ResolveAssemblyReference.cache
Binary file not shown
View
12 obj/x86/Debug/dotNetResearch.csproj.FileListAbsolute.txt
@@ -0,0 +1,12 @@
+c:\documents and settings\administrator\my documents\visual studio 2010\Projects\dotNetResearch\dotNetResearch\bin\Debug\dotNetResearch.pdb
+c:\documents and settings\administrator\my documents\visual studio 2010\Projects\dotNetResearch\dotNetResearch\obj\x86\Debug\ResolveAssemblyReference.cache
+c:\documents and settings\administrator\my documents\visual studio 2010\Projects\dotNetResearch\dotNetResearch\obj\x86\Debug\dotNetResearch.pdb
+C:\Documents and Settings\Administrator\my documents\visual studio 2010\Projects\dotNetResearch\dotNetResearch\bin\Debug\dotNetResearch.exe
+C:\Documents and Settings\Administrator\my documents\visual studio 2010\Projects\dotNetResearch\dotNetResearch\obj\x86\Debug\dotNetResearch.exe
+D:\Documents and Settings\Administrator\My Documents\Visual Studio 2010\Projects\dotNetResearch\dotNetResearch\obj\x86\Debug\ResolveAssemblyReference.cache
+D:\Documents and Settings\Administrator\My Documents\Visual Studio 2010\Projects\dotNetResearch\dotNetResearch\obj\x86\Debug\dotNetResearch.exe
+D:\Documents and Settings\Administrator\My Documents\Visual Studio 2010\Projects\dotNetResearch\dotNetResearch\obj\x86\Debug\dotNetResearch.pdb
+D:\Documents and Settings\Administrator\My Documents\Visual Studio 2010\Projects\dotNetResearch\dotNetResearch\bin\Debug\dotNetResearch.exe
+D:\Documents and Settings\Administrator\My Documents\Visual Studio 2010\Projects\dotNetResearch\dotNetResearch\bin\Debug\dotNetResearch.pdb
+D:\Documents and Settings\Administrator\My Documents\Visual Studio 2010\Projects\dotNetResearch\dotNetResearch\bin\Debug\Castle.Core.dll
+D:\Documents and Settings\Administrator\My Documents\Visual Studio 2010\Projects\dotNetResearch\dotNetResearch\bin\Debug\Castle.Core.xml
View
BIN  obj/x86/Debug/dotNetResearch.exe
Binary file not shown
View
BIN  obj/x86/Debug/dotNetResearch.pdb
Binary file not shown
View
BIN  obj/x86/Release/DesignTimeResolveAssemblyReferencesInput.cache
Binary file not shown
View
5 obj/x86/Release/dotNetResearch.csproj.FileListAbsolute.txt
@@ -0,0 +1,5 @@
+C:\Documents and Settings\Administrator\my documents\visual studio 2010\Projects\dotNetResearch\dotNetResearch\bin\Release\dotNetResearch.exe
+C:\Documents and Settings\Administrator\my documents\visual studio 2010\Projects\dotNetResearch\dotNetResearch\bin\Release\dotNetResearch.pdb
+C:\Documents and Settings\Administrator\my documents\visual studio 2010\Projects\dotNetResearch\dotNetResearch\obj\x86\Release\ResolveAssemblyReference.cache
+C:\Documents and Settings\Administrator\my documents\visual studio 2010\Projects\dotNetResearch\dotNetResearch\obj\x86\Release\dotNetResearch.exe
+C:\Documents and Settings\Administrator\my documents\visual studio 2010\Projects\dotNetResearch\dotNetResearch\obj\x86\Release\dotNetResearch.pdb
View
BIN  obj/x86/Release/dotNetResearch.exe
Binary file not shown
View
BIN  obj/x86/Release/dotNetResearch.pdb
Binary file not shown
View
5 packages.config
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" />
+ <package id="WebActivator" version="1.5" />
+</packages>
View
32 yield.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace dotNetResearch {
+ public class NumberList {
+ // Create an array of integers.
+ public static int[] ints = { 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377 };
+
+ // Define a property that returns only the even numbers.(偶数)
+ public static IEnumerable<int> GetEven() {
+ // Use yield to return the even numbers in the list.
+ foreach (int i in ints)
+ if (i % 2 == 0)
+ yield return i;
+ }
+
+ //static void Main(string[] args) {
+
+ // // Display the even numbers.
+ // //Console.WriteLine("Even numbers");
+ // //foreach (int i in NumberList.GetEven())
+ // // Console.WriteLine(i);
+
+ // //Type t = typeof(NumberList);
+
+ // //t.GetProperties().Select(x => x.GetAccessors(false).Length == 0);
+ //}
+
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.