这是indexloc提供的服务,不要输入任何密码
Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added notebooks/linq/DotNetCards/Back.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added notebooks/linq/DotNetCards/ClubsAce.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added notebooks/linq/DotNetCards/ClubsEight.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added notebooks/linq/DotNetCards/ClubsFive.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added notebooks/linq/DotNetCards/ClubsFour.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added notebooks/linq/DotNetCards/ClubsJack.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added notebooks/linq/DotNetCards/ClubsKing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added notebooks/linq/DotNetCards/ClubsNine.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added notebooks/linq/DotNetCards/ClubsQueen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added notebooks/linq/DotNetCards/ClubsSeven.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added notebooks/linq/DotNetCards/ClubsSix.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added notebooks/linq/DotNetCards/ClubsTen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added notebooks/linq/DotNetCards/ClubsThree.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added notebooks/linq/DotNetCards/ClubsTwo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added notebooks/linq/DotNetCards/DiamondsAce.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added notebooks/linq/DotNetCards/DiamondsEight.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added notebooks/linq/DotNetCards/DiamondsFive.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added notebooks/linq/DotNetCards/DiamondsFour.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added notebooks/linq/DotNetCards/DiamondsJack.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added notebooks/linq/DotNetCards/DiamondsKing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added notebooks/linq/DotNetCards/DiamondsNine.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added notebooks/linq/DotNetCards/DiamondsQueen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added notebooks/linq/DotNetCards/DiamondsSeven.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added notebooks/linq/DotNetCards/DiamondsSix.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added notebooks/linq/DotNetCards/DiamondsTen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added notebooks/linq/DotNetCards/DiamondsThree.png
Binary file added notebooks/linq/DotNetCards/DiamondsTwo.png
Binary file added notebooks/linq/DotNetCards/HeartsAce.png
Binary file added notebooks/linq/DotNetCards/HeartsEight.png
Binary file added notebooks/linq/DotNetCards/HeartsFive.png
Binary file added notebooks/linq/DotNetCards/HeartsFour.png
Binary file added notebooks/linq/DotNetCards/HeartsJack.png
Binary file added notebooks/linq/DotNetCards/HeartsKing.png
Binary file added notebooks/linq/DotNetCards/HeartsNine.png
Binary file added notebooks/linq/DotNetCards/HeartsQueen.png
Binary file added notebooks/linq/DotNetCards/HeartsSeven.png
Binary file added notebooks/linq/DotNetCards/HeartsSix.png
Binary file added notebooks/linq/DotNetCards/HeartsTen.png
Binary file added notebooks/linq/DotNetCards/HeartsThree.png
Binary file added notebooks/linq/DotNetCards/HeartsTwo.png
Binary file added notebooks/linq/DotNetCards/NoneHighJoker.png
Binary file added notebooks/linq/DotNetCards/NoneLowJoker.png
Binary file added notebooks/linq/DotNetCards/SpadesAce.png
Binary file added notebooks/linq/DotNetCards/SpadesEight.png
Binary file added notebooks/linq/DotNetCards/SpadesFive.png
Binary file added notebooks/linq/DotNetCards/SpadesFour.png
Binary file added notebooks/linq/DotNetCards/SpadesJack.png
Binary file added notebooks/linq/DotNetCards/SpadesKing.png
Binary file added notebooks/linq/DotNetCards/SpadesNine.png
Binary file added notebooks/linq/DotNetCards/SpadesQueen.png
Binary file added notebooks/linq/DotNetCards/SpadesSeven.png
Binary file added notebooks/linq/DotNetCards/SpadesSix.png
Binary file added notebooks/linq/DotNetCards/SpadesTen.png
Binary file added notebooks/linq/DotNetCards/SpadesThree.png
Binary file added notebooks/linq/DotNetCards/SpadesTwo.png
102 changes: 80 additions & 22 deletions notebooks/linq/index.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,15 @@
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"execution_count": null,
"metadata": {
"dotnet_interactive": {
"language": "csharp"
},
"vscode": {
"languageId": "dotnet-interactive.csharp"
}
},
"outputs": [],
"source": [
"public enum Suit\n",
Expand Down Expand Up @@ -68,8 +75,15 @@
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"execution_count": null,
"metadata": {
"dotnet_interactive": {
"language": "csharp"
},
"vscode": {
"languageId": "dotnet-interactive.csharp"
}
},
"outputs": [],
"source": [
"public class Card\n",
Expand Down Expand Up @@ -100,8 +114,15 @@
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"execution_count": null,
"metadata": {
"dotnet_interactive": {
"language": "csharp"
},
"vscode": {
"languageId": "dotnet-interactive.csharp"
}
},
"outputs": [],
"source": [
"static IEnumerable<Suit> Suits() => Enum.GetValues(typeof(Suit)) as IEnumerable<Suit>;\n",
Expand Down Expand Up @@ -149,27 +170,37 @@
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"execution_count": null,
"metadata": {
"dotnet_interactive": {
"language": "csharp"
},
"vscode": {
"languageId": "dotnet-interactive.csharp"
}
},
"outputs": [],
"source": [
"Formatter<Deck>.Register((deck, writer) =>\n",
"using Microsoft.DotNet.Interactive.Formatting;\n",
"using static Microsoft.DotNet.Interactive.Formatting.PocketViewTags;\n",
"\n",
"Formatter.Register<Deck>((deck, writer) =>\n",
"{\n",
" PocketView v = div(\n",
" Enumerable.Range(0,4).Select(row =>\n",
" div(deck.Cards.Skip(row * 13).Take(13).Select(c =>\n",
" {\n",
" var face = Enum.GetName(typeof(Rank), c.Rank);\n",
" var suit = Enum.GetName(typeof(Suit), c.Suit);\n",
" return img[src:$\"https://dotnetcards.azureedge.net/cards/{suit}{face}.png\", width:64]();\n",
" return img[src:$\"./DotNetCards/{suit}{face}.png\", width:64]();\n",
" }))));\n",
" writer.Write(v);\n",
"}, \"text/html\");\n",
"\n",
"Console.WriteLine(\".NET Interactive can display the deck of cards\");\n",
"\n",
"Deck d = new Deck();\n",
"display(d);"
"display(d);\n"
]
},
{
Expand Down Expand Up @@ -199,8 +230,15 @@
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"execution_count": null,
"metadata": {
"dotnet_interactive": {
"language": "csharp"
},
"vscode": {
"languageId": "dotnet-interactive.csharp"
}
},
"outputs": [],
"source": [
"static IEnumerable<T> InterleaveSequenceWith<T> (this IEnumerable<T> first, IEnumerable<T> second)\n",
Expand Down Expand Up @@ -233,8 +271,15 @@
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"execution_count": null,
"metadata": {
"dotnet_interactive": {
"language": "csharp"
},
"vscode": {
"languageId": "dotnet-interactive.csharp"
}
},
"outputs": [],
"source": [
"static bool SequenceEquals<T>(this IEnumerable<T> first, IEnumerable<T> second)\n",
Expand Down Expand Up @@ -264,9 +309,14 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": null,
"metadata": {
"scrolled": false
"dotnet_interactive": {
"language": "csharp"
},
"vscode": {
"languageId": "dotnet-interactive.csharp"
}
},
"outputs": [],
"source": [
Expand All @@ -285,8 +335,15 @@
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"execution_count": null,
"metadata": {
"dotnet_interactive": {
"language": "csharp"
},
"vscode": {
"languageId": "dotnet-interactive.csharp"
}
},
"outputs": [],
"source": [
"int numberOfShuffles = 0;\n",
Expand Down Expand Up @@ -351,9 +408,10 @@
"mimetype": "text/x-csharp",
"name": "C#",
"pygments_lexer": "csharp",
"version": "8.0"
}
"version": "9.0"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 4
"nbformat_minor": 2
}