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
Imports System.Runtime.CompilerServices | |
Imports System.Dynamic | |
Module DatabaseExtensions | |
Sub Main() | |
Dim conn = New SqlClient.SqlConnection("Data Source=...") | |
Dim one = Convert.ToInt32(conn.ExecuteScalar("SELECT 1")) |
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
Imports System | |
Imports System.ComponentModel | |
Imports System.Linq | |
Imports System.Linq.Expressions | |
Imports System.Reactive.Linq | |
Imports System.Runtime.CompilerServices | |
''' <summary> | |
''' INotifyPropertyChanged に拡張メソッドを追加し、PropertyChanged イベントを IObservable で監視可能にします。 | |
''' </summary> |
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
'例えば、30秒間隔で状態監視を実行する場合とか | |
Dim ループ = New CancellationTokenSource() | |
Dim 状態監視間隔の待機 As CancellationTokenSource | |
Dim 状態監視タスク = Task.Factory.StartNew( | |
Sub() | |
While True | |
' 状態を監視する処理を実行 |
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
Module EnumerableExBuffer | |
<Extension> | |
Public Function Buffer(Of T)( | |
ByVal source As IEnumerable(Of T), | |
ByVal count As Integer | |
) As IEnumerable(Of T()) | |
If source Is Nothing Then Throw New ArgumentNullException("source") |
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
Enum PropertyChainMode | |
CopyOnly | |
RaiseOnly | |
CopyAndRaise | |
End Enum | |
Class PropertyChain(Of TSource As {Class, INotifyPropertyChanged}, TTarget) | |
Private WithEvents _source As TSource | |
Private _target As TTarget |
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.Collections.Generic; | |
using System.Drawing; | |
using System.Drawing.Printing; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace Printer.Sample | |
{ |
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; | |
namespace ConsoleApplication1 | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
if (args.Select(_ => _.ToUpper()).Any(_ => _ == "C")) |
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
Module Module1 | |
Sub Main() | |
' 1000,2500,5000 の最大公約数を求める | |
Dim n = {1000, 2500, 5000}.Aggregate(AddressOf GDC) | |
Console.WriteLine(n) | |
Console.ReadLine() | |
End Sub |
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.Collections.Concurrent; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Runtime.InteropServices; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace ConsoleApplication1 | |
{ |
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.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Reactive; | |
using System.Reactive.Disposables; | |
using System.Reactive.Linq; | |
using System.Reactive.Subjects; | |
using System.Text; | |
using System.Threading.Tasks; |
OlderNewer