anatawa12 :vrc::unity::unityerror: on Nostr: public static IEnumerable<(T, T)> ZipWithNext<T>(this IEnumerable<T> enumerable) { ...
public static IEnumerable<(T, T)> ZipWithNext<T>(this IEnumerable<T> enumerable)
{
using (var enumerator = enumerable.GetEnumerator())
{
if (!enumerator.MoveNext()) yield break;
var prev = enumerator.Current;
while (enumerator.MoveNext())
{
var current = enumerator.Current;
yield return (prev, current);
prev = current;
}
}
}
地味だけど便利なやつ
Published at
2024-09-01 10:24:29Event JSON
{
"id": "754dc09fe510e8fadb2c4a4d739d618a90664b978249aa2962e9def658bf49a0",
"pubkey": "b45689074d7e80155255eaa355be4a32287b4f6a7e7b56eb33f5aeb7818cdd13",
"created_at": 1725186269,
"kind": 1,
"tags": [
[
"proxy",
"https://misskey.niri.la/notes/9xmzoa5k88",
"activitypub"
]
],
"content": "\n\npublic static IEnumerable\u003c(T, T)\u003e ZipWithNext\u003cT\u003e(this IEnumerable\u003cT\u003e enumerable)\n{\n using (var enumerator = enumerable.GetEnumerator())\n {\n if (!enumerator.MoveNext()) yield break;\n var prev = enumerator.Current;\n while (enumerator.MoveNext())\n {\n var current = enumerator.Current;\n yield return (prev, current);\n prev = current;\n }\n }\n}\n地味だけど便利なやつ",
"sig": "4f55ef39a3f3650962acbabaf2f0e3dcee0d3afe1056599c262a3ce5ec145e556cf97f3360780851b1ab5018ca33b35efa3f837c07070baa630cb5466cb6d856"
}