<Extension>
Public Iterator Function Repeat(Of T)(element As T) As IEnumerable(Of T)
While True
Yield element
End While
End Function
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
ctx.Database.Log = message => Console.WriteLine(message); |
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
<Query Kind="Statements"> | |
<Reference><RuntimeDirectory>\System.Windows.Forms.dll</Reference> | |
<NuGetReference>OxyPlot.WindowsForms</NuGetReference> | |
<Namespace>OxyPlot</Namespace> | |
<Namespace>OxyPlot.Axes</Namespace> | |
<Namespace>OxyPlot.Series</Namespace> | |
</Query> | |
var pm = new PlotModel | |
{ |
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.ComponentModel | |
Public Class Form1 | |
Private _model As New Model() | |
Public Sub New() | |
InitializeComponent() |
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
void Main() | |
{ | |
var connection = ConnectionMultiplexer.Connect("192.168.5.40"); | |
var sx1 = connection.ObservableSubscription("pa"); | |
using (sx1.Subscribe(_ => Console.WriteLine(_))) Console.ReadLine(); | |
var sx2 = connection.ObservableList("qa", TimeSpan.FromSeconds(5)); | |
using (sx2.Subscribe(_ => Console.WriteLine(_))) Console.ReadLine(); | |
別に TaskCompletionSource でハマったわけではないですが、TaskCompletionSource で作成したタスクを Async/Await で待ったときにハマってしまった。
元々、OPC Automation で非同期入出力が、コマンドに対しイベントで完了を通知していますので、TaskCompletionSource を使って Task にする説明を考えていました。
最初に、チョロット書こうとしていたことを事実を捻じ曲げて説明します。(本当は引数等が違います。) OPC Automation では、AsyncRead に対し完了を AsyncReadComplete イベントで通知し、操作のキャンセルも AsyncCancel に対し AsyncCancelComplete で完了を通知しています。
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
public static Class EnumerableEx | |
{ | |
} |
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
open System.Net | |
open System.Net.Sockets | |
type IpMessenger (port: int) = | |
let client = new UdpClient(port) | |
let random = new Random(Environment.TickCount) | |
let nextId = fun () -> random.Next(0, 1000) | |
let sendBuffer (address: IPAddress, message: Byte[]) = | |
client.Send(message, message.Length, new IPEndPoint(address, 2425)) |
NewerOlder