{"id":1929,"date":"2024-10-30T06:32:54","date_gmt":"2024-10-30T04:32:54","guid":{"rendered":"https:\/\/epicmarketing.co.il\/notebook\/?p=1929"},"modified":"2024-10-31T12:32:33","modified_gmt":"2024-10-31T10:32:33","slug":"c-generics","status":"publish","type":"post","link":"https:\/\/epicmarketing.co.il\/notebook\/c-generics\/","title":{"rendered":"C# Generics"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u05d0\u05d7\u05ea \u05d4\u05d3\u05d5\u05d2\u05de\u05d0\u05d5\u05ea \u05d4\u05e9\u05db\u05d9\u05d7\u05d5\u05ea \u05dc-Generics \u05d4\u05d9\u05d0 \u05d4-List. \u05d0\u05e0\u05d7\u05e0\u05d5 \u05d9\u05db\u05d5\u05dc\u05d9\u05dd \u05dc\u05d9\u05e6\u05d5\u05e8 List \u05de\u05e1\u05d5\u05d2\u05d9\u05dd \u05e9\u05d5\u05e0\u05d9\u05dd.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nList&lt;int&gt; numbers = &#x5B;1, 2, 3];\nList&lt;string&gt; strings = &#x5B;&quot;a&quot;, &quot;b&quot;, &quot;c&quot;];\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">int \u05e9\u05d5\u05e0\u05d4 \u05de-string \u05d5\u05d1\u05db\u05dc \u05d6\u05d0\u05ea \u05d5\u05dc\u05e9\u05e0\u05d9\u05d4\u05dd \u05d0\u05e0\u05d7\u05e0\u05d5 \u05de\u05e9\u05ea\u05de\u05e9\u05d9\u05dd \u05d1-List. \u05d0\u05dd \u05e0\u05e9\u05d9\u05dd \u05e2\u05e8\u05da \u05de\u05e1\u05d5\u05d2 \u05e9\u05d5\u05e0\u05d4 \u05de\u05d6\u05d4 \u05e9\u05dc \u05e1\u05d5\u05d2 \u05d4\u05de\u05d5\u05d2\u05d3\u05e8, \u05d4\u05e7\u05d5\u05de\u05e4\u05d9\u05d9\u05dc\u05e8 \u05d9\u05e6\u05e2\u05e7.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u05e0\u05d5\u05db\u05dc \u05d2\u05dd \u05dc\u05d4\u05d2\u05d3\u05d9\u05e8 List \u05de\u05e1\u05d5\u05d2 object \u05d5\u05d6\u05d4 \u05d9\u05e2\u05d1\u05d5\u05d3, \u05db\u05d9 \u05db\u05dc \u05d3\u05d1\u05e8 \u05d4\u05d5\u05d0 object:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nList&lt;object&gt; objects = &#x5B;&quot;a&quot;, 4];\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">\u05d4\u05d2\u05d3\u05e8\u05d4 \u05db\u05d6\u05d0\u05ea \u05dc\u05d0 \u05ea\u05d4\u05d9\u05d4 \u05d9\u05e2\u05d9\u05dc\u05d4 \u05db\u05d9 \u05d4\u05e2\u05e8\u05db\u05d9\u05dd \u05d9\u05d5\u05de\u05e8\u05d5 \u05dc\u05d0\u05d5\u05d1\u05d9\u05d9\u05e7\u05d8\u05d9\u05dd \u05d5\u05d9\u05d1\u05d6\u05d1\u05d6\u05d5 \u05d6\u05d9\u05db\u05e8\u05d5\u05df \u05d5\u05d2\u05dd \u05d0\u05d9\u05df \u05dc\u05d9 \u05d1\u05d3\u05d9\u05e7\u05d4 \u05e9\u05dc  \u05e1\u05d5\u05d2 \u05e9\u05e0\u05d5\u05ea\u05e0\u05ea \u05e9\u05db\u05d1\u05ea \u05d0\u05d1\u05d8\u05d7\u05d4 \u05dc\u05de\u05d9\u05d3\u05e2 \u05e9\u05e0\u05db\u05e0\u05e1 \u05dc-List. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u05db\u05d3\u05d9 \u05dc\u05d8\u05e4\u05dc \u05d1\u05d9\u05e2\u05d9\u05dc\u05d5\u05ea \u05d5\u05d1\u05d1\u05d3\u05d9\u05e7\u05ea \u05e1\u05d5\u05d2, \u05d1\u05de\u05e7\u05d5\u05dd \u05e9\u05d9\u05d4\u05d9\u05d4 \u05dc\u05e0\u05d5 \u05e1\u05d5\u05d2 \u05d0\u05d7\u05d3 \u05e9\u05dc List \u05de\u05e1\u05d5\u05d2 object \u05d5\u05d0\u05dc\u05d9\u05d5 \u05e0\u05d5\u05db\u05dc \u05dc\u05e9\u05dc\u05d5\u05d7 \u05db\u05dc type \u05e9\u05e0\u05e8\u05e6\u05d4, \u05d9\u05e9 \u05dc\u05e0\u05d5 \u05d0\u05e4\u05e9\u05e8\u05d5\u05ea \u05dc\u05d4\u05d2\u05d3\u05d9\u05e8 List \u05de\u05e1\u05d5\u05d2\u05d9\u05dd \u05e9\u05d5\u05e0\u05d9\u05dd.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u05d4\u05d2\u05d3\u05e8\u05d4 Generics<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Generics \u05d4\u05dd \u05d4\u05d3\u05e8\u05da \u05dc\u05d9\u05e6\u05d5\u05e8 classes, \u05e4\u05d5\u05e0\u05e7\u05e6\u05d9\u05d5\u05ea \u05d5\u05d0\u05d5\u05e1\u05e4\u05d9\u05dd \u05e9\u05d9\u05db\u05d5\u05dc\u05d9\u05dd \u05dc\u05e2\u05d1\u05d5\u05d3 \u05e2\u05dd \u05db\u05dc \u05e1\u05d5\u05d2 \u05e9\u05dc data \u05d5\u05dc\u05e1\u05e4\u05e7 \u05d1\u05d3\u05d9\u05e7\u05ea type. \u05d6\u05d4 \u05de\u05d0\u05e4\u05e9\u05e8 \u05dc\u05d9\u05e6\u05d5\u05e8 \u05e7\u05d5\u05d3 \u05e4\u05e2\u05dd \u05d0\u05d7\u05ea \u05d5\u05dc\u05d4\u05e9\u05ea\u05de\u05e9 \u05d1\u05d5 \u05d1\u05de\u05e7\u05e8\u05d9\u05dd \u05e9\u05d5\u05e0\u05d9\u05dd.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Generics \u05de\u05d0\u05e4\u05e9\u05e8\u05d9\u05dd \u05dc\u05db\u05ea\u05d5\u05d1 \u05e7\u05d5\u05d3 \u05d2\u05de\u05d9\u05e9 \u05d5\u05e9\u05e0\u05d9\u05ea\u05df \u05dc\u05d4\u05e9\u05ea\u05de\u05e9 \u05d1\u05d5 \u05e9\u05d9\u05de\u05d5\u05e9 \u05d7\u05d5\u05d6\u05e8 \u05d5\u05d4\u05dd \u05de\u05d5\u05e0\u05e2\u05d9\u05dd \u05e9\u05d2\u05d9\u05d0\u05d5\u05ea \u05e9\u05dc \u05d4\u05db\u05e0\u05e1\u05ea type \u05dc\u05d0 \u05e0\u05db\u05d5\u05df, \u05de\u05d4 \u05e9\u05d9\u05db\u05d5\u05dc \u05dc\u05d4\u05ea\u05e8\u05d7\u05e9 \u05db\u05e9\u05de\u05e9\u05ea\u05de\u05e9\u05d9\u05dd \u05d1\u05e1\u05d5\u05d2 \u05e9\u05dc object.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u05e4\u05d5\u05e0\u05e7\u05e6\u05d9\u05d4 \u05d2\u05e0\u05e8\u05d9\u05ea<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u05e0\u05e1\u05ea\u05db\u05dc \u05e2\u05dc \u05d4\u05e4\u05d5\u05e0\u05e7\u05e6\u05d9\u05d4 TypeChecker \u05e9\u05de\u05e7\u05d1\u05dc\u05ea \u05de\u05e9\u05ea\u05e0\u05d4 \u05de\u05e1\u05d5\u05d2 \u05db\u05dc\u05e9\u05d4\u05d5. \u05d0\u05ea \u05d4\u05e1\u05d5\u05d2 \u05e9\u05d4\u05e4\u05d5\u05e0\u05e7\u05e6\u05d9\u05d4 \u05e2\u05d5\u05d1\u05d3\u05ea \u05d0\u05d9\u05ea\u05d5 \u05de\u05e1\u05de\u05e0\u05d9\u05dd \u05d1\u05ea\u05df\u05da &lt;>. \u05db\u05d1\u05e8\u05d9\u05e8\u05ea \u05de\u05d7\u05d3\u05dc \u05de\u05d5\u05e1\u05db\u05de\u05ea, \u05d4\u05d0\u05d5\u05ea \u05e9\u05e0\u05e9\u05ea\u05de\u05e9 \u05d1\u05d4 \u05dc-Generics \u05d4\u05d9\u05d0 T.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nvoid TypeChecker&lt;T&gt;(T value)\n{\n    Console.WriteLine(&quot;Type: &quot; + typeof(T));\n    Console.WriteLine(&quot;Value: &quot; + value);\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">TypeChecker \u05de\u05e1\u05d5\u05d2 int, \u05d9\u05e7\u05d1\u05dc \u05db\u05e2\u05e8\u05da \u05dc\u05e4\u05d5\u05e0\u05e7\u05e6\u05d9\u05d4 type \u05e9\u05dc int \u05d5\u05db\u05df \u05dc\u05d2\u05d1\u05d9 \u05e9\u05d0\u05e8 \u05e1\u05d5\u05d2\u05d9 \u05d4\u05de\u05e9\u05ea\u05e0\u05d9\u05dd.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u05d0\u05dd \u05e0\u05d2\u05d3\u05d9\u05e8 \u05de\u05e9\u05ea\u05e0\u05d4 \u05e9\u05dc \u05de\u05d1\u05e0\u05d4 \u05db\u05dc\u05e9\u05d4\u05d5 \u05d5\u05e0\u05e9\u05dc\u05d7 \u05d0\u05d5\u05ea\u05d5 \u05dc\u05e4\u05d5\u05e0\u05e7\u05e6\u05d9\u05d4, \u05d4\u05d9\u05d0 \u05d2\u05dd \u05ea\u05e2\u05d1\u05d5\u05d3.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nrecord PersonRecord(string firstName, string lastName);\nTypeChecker(new PersonRecord(&quot;fn&quot;, &quot;ln&quot;);\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">\u05d4\u05e4\u05d5\u05e0\u05e7\u05e6\u05d9\u05d4 \u05de\u05d0\u05e4\u05e9\u05e8\u05ea \u05dc\u05e0\u05d5 \u05dc\u05e9\u05dc\u05d5\u05d7 \u05d0\u05dc\u05d9\u05d4 \u05db\u05dc type \u05d5\u05dc\u05e7\u05d1\u05dc \u05de\u05de\u05e0\u05d4 \u05d0\u05ea \u05d4\u05ea\u05d5\u05e6\u05d0\u05d4 \u05e9\u05d0\u05e0\u05d7\u05e0\u05d5 \u05e8\u05d5\u05e6\u05d9\u05dd. \u05d0\u05dd \u05dc\u05d0 \u05d4\u05d9\u05d9\u05e0\u05d5 \u05de\u05e9\u05ea\u05de\u05e9\u05d9\u05dd \u05d1\u05e4\u05d5\u05e0' \u05d2\u05e0\u05e8\u05d9\u05ea \u05d4\u05d9\u05d9\u05e0\u05d5 \u05e6\u05e8\u05d9\u05db\u05d9\u05dd \u05dc\u05d4\u05d2\u05d3\u05d9\u05e8 \u05e4\u05d5\u05e0\u05e7\u05e6\u05d9\u05d5\u05ea \u05e9\u05d5\u05e0\u05d5\u05ea \u05dc\u05db\u05dc type \u05dc\u05de\u05e9\u05dc: TypeCheckerString, TypeCheckerInt \u05d5\u05db\u05df \u05d4\u05dc\u05d0\u05d4, \u05e9\u05de\u05e7\u05d1\u05dc\u05d5\u05ea \u05d0\u05ea \u05e1\u05d5\u05d2 \u05d4\u05e0\u05ea\u05d5\u05e0\u05d9\u05dd \u05e9\u05de\u05ea\u05d0\u05d9\u05dd \u05dc\u05d4\u05df. \u05d5\u05d0\u05d6 \u05d2\u05dd \u05d4\u05d9\u05d9\u05ea\u05d9 \u05e6\u05e8\u05d9\u05db\u05d4 \u05dc\u05d4\u05ea\u05db\u05d5\u05e0\u05df \u05dc\u05db\u05dc \u05e1\u05d5\u05d2 \u05d0\u05e4\u05e9\u05e8\u05d9, \u05db\u05e9\u05d9\u05e9 \u05db\u05d0\u05dc\u05d4 \u05e9\u05dc\u05d0 \u05d9\u05d3\u05d5\u05e2\u05d9\u05dd \u05dc\u05d9 \u05e2\u05d3\u05d9\u05d9\u05df.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Generic Class<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\npublic class BetterList&lt;T&gt;\n{\n    private List&lt;T&gt; data = new();\n\n    public void AddToList(T value)\n    {\n        data.Add(value);\n        Console.WriteLine($&quot;{value} has been added to the list&quot;);\n    }\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">\u05d4\u05e2\u05d1\u05e8\u05ea\u05d9 T \u05dc-class \u05d5\u05d1\u05e7\u05e9\u05ea\u05d9 \u05dc\u05d9\u05e6\u05d5\u05e8 \u05dc\u05d9 List \u05e9\u05dc T. \u05d6\u05d4 \u05de\u05d9\u05d9\u05e6\u05e8 \u05dc\u05d9 \u05e8\u05e9\u05d9\u05de\u05d4 \u05e2\u05dc \u05e1\u05de\u05da \u05d4-type \u05e9\u05d4\u05e2\u05d1\u05e8\u05ea\u05d9. \u05d0\u05d7\u05e8 \u05db\u05da \u05e0\u05d3\u05e4\u05d9\u05e1 \u05d0\u05ea \u05d4\u05e2\u05e8\u05da \u05e9\u05e0\u05d5\u05e1\u05e3.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u05e2\u05db\u05e9\u05d9\u05d5 \u05e0\u05e9\u05ea\u05de\u05e9 \u05d1-class \u05e9\u05d9\u05e6\u05e8\u05e0\u05d5.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nBetterList&lt;int&gt; betterNumbers = new();\nbetterNumbers.AddToList(5);\n\nBetterList&lt;PersonRecord&gt; people = new();\nbetterNumbers.AddToList(new PersonRecord(&quot;fn&quot;, &quot;ln&quot;));\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\">Generic Interface<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\npublic interface IImportance&lt;T&gt;\n{\n    T MostImportant(T a, T b);\n}\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\npublic class EvaluateImportance : IImportance&lt;int&gt;, IImportance&lt;string&gt;\n{\n    public int MostImportant(int a, int b)\n    {\n        ...\n    }\n\n    public string MostImportant(string a, string b)\n    {\n        ...\n    }\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">\u05d0\u05e4\u05e9\u05e8 \u05dc\u05de\u05de\u05e9 Interface \u05d2\u05e0\u05e8\u05d9 \u05d5\u05dc\u05de\u05de\u05e9 \u05d0\u05d5\u05ea\u05d5 \u05e2\u05dc types \u05e9\u05d5\u05e0\u05d9\u05dd.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Constraints<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u05e0\u05e0\u05d9\u05d7 \u05e9\u05d0\u05e0\u05d9 \u05e8\u05d5\u05e6\u05d4 \u05dc\u05d9\u05e6\u05d5\u05e8 class \u05d2\u05e0\u05e8\u05d9, \u05d0\u05d1\u05dc \u05d0\u05e0\u05d9 \u05dc\u05d0 \u05e8\u05d5\u05e6\u05d4 \u05e9\u05d9\u05d4\u05d9\u05d4 \u05d0\u05e4\u05e9\u05e8 \u05dc\u05d4\u05e9\u05ea\u05de\u05e9 \u05d1\u05d5 \u05d1\u05db\u05dc \u05e1\u05d5\u05d2 \u05e9\u05dc \u05de\u05e9\u05ea\u05e0\u05d4. \u05d0\u05d5 \u05e9\u05d0\u05e0\u05d9 \u05e8\u05d5\u05e6\u05d4 \u05dc\u05d9\u05d9\u05e6\u05e8 \u05d4\u05d2\u05d1\u05dc\u05d5\u05ea \u05d0\u05d7\u05e8\u05d5\u05ea \u05dc-class, \u05d9\u05e9 \u05d0\u05e4\u05e9\u05e8\u05d5\u05ea \u05dc\u05d9\u05d9\u05e6\u05e8 Constraints.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\n\/\/ Constraints: new() -&gt; this class must have an empty constructor\npublic class SomeClass&lt;T&gt; where T : new()\n{\n}\n\n\/\/ Constraints: class -&gt; this class must be of type class\npublic class SomeClass&lt;T&gt; where T : class\n{\n}\n\n\/\/ Constraints: class? -&gt; this class must a nullable class\npublic class SomeClass&lt;T&gt; where T : class?\n{\n}\n\n\/\/ Constraints: notnull-&gt; this class must not be null\npublic class SomeClass&lt;T&gt; where T : notnull\n{\n}\n\n\/\/ Constraints: BetterList&lt;T&gt;-&gt; this class must be of BetterList class\npublic class SomeClass&lt;T&gt; where T : BetterList&lt;T&gt;\n{\n}\n\n\/\/ Constraints: The class can be of 2 types and they \n\/\/ need to be the same or u derived from T\npublic class SomeClass&lt;T, U&gt; where T : U\n{\n}\n\n\/\/ Constraints: T has to be INumber\n\/\/ The operation x+y can be implementer, only because T is INumber\n\/\/ Otherwise you can&#039;t use + between 2 objects.\npublic class SomeClass&lt;T&gt; where T : INumber&lt;T&gt;\n{\n    public T Add(T x, T y)\n    {\n        return x+y;\n    }\n}\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\">\u05d3\u05d5\u05d2\u05de\u05d0\u05d5\u05ea \u05de\u05d4\u05d7\u05d9\u05d9\u05dd<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u05e0\u05e8\u05d0\u05d4 \u05e9\u05d9\u05de\u05d5\u05e9 \u05dc\u05d3\u05d5\u05d2\u05de\u05d0 \u05d1-generics \u05d1\u05d0\u05ea\u05e8 \u05e9\u05dc \u05de\u05e1\u05d7\u05e8 \u05d0\u05dc\u05e7\u05d8\u05e8\u05d5\u05e0\u05d9.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Repository Pattern<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u05e0\u05e8\u05d0\u05d4 \u05d9\u05d9\u05e9\u05d5\u05dd \u05e9\u05dc generic repository. \u05e9\u05db\u05d1\u05ea repository \u05de\u05e9\u05de\u05e9\u05ea \u05dc\u05d8\u05d9\u05e4\u05d5\u05dc \u05d1\u05d0\u05d9\u05e0\u05d8\u05e8\u05d0\u05e7\u05e6\u05d9\u05d4 \u05d1\u05d9\u05df \u05d4\u05d0\u05e4\u05dc\u05d9\u05e7\u05e6\u05d9\u05d4 \u05dc-DB. \u05d1\u05de\u05e7\u05d5\u05dd \u05dc\u05d9\u05e6\u05d5\u05e8 repositories \u05dc\u05db\u05dc \u05de\u05d5\u05d3\u05dc \u05d1\u05e0\u05e4\u05e8\u05d3 \u05e0\u05d1\u05e0\u05d4 \u05d0\u05d7\u05d3 \u05d2\u05e0\u05e8\u05d9.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\npublic interface IRepository&lt;T&gt; where T : class\n{\n    IEnumerable&lt;T&gt; GetAll();\n    T GetById(int id);\n    void Add(T entity);\n    void Update(T entity);\n    void Delete(int id);\n}\n\npublic class Repository&lt;T&gt; : IRepository&lt;T&gt; where T : class\n{\n    private readonly DbContext _context;\n    private readonly DbSet&lt;T&gt; _dbSet;\n\n    public Repository(DbContext context)\n    {\n        _context = context;\n        _dbSet = context.Set&lt;T&gt;();\n    }\n\n    public IEnumerable&lt;T&gt; GetAll()\n    {\n        return _dbSet.ToList();\n    }\n\n    public T GetById(int id)\n    {\n        return _dbSet.Find(id);\n    }\n\n    public void Add(T entity)\n    {\n        _dbSet.Add(entity);\n        _context.SaveChanges();\n    }\n\n    public void Update(T entity)\n    {\n        _dbSet.Update(entity);\n        _context.SaveChanges();\n    }\n\n    public void Delete(int id)\n    {\n        var entity = _dbSet.Find(id);\n        if (entity != null)\n        {\n            _dbSet.Remove(entity);\n            _context.SaveChanges();\n        }\n    }\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">\u05e2\u05db\u05e9\u05d9\u05d5 \u05d0\u05e4\u05e9\u05e8 \u05dc\u05d8\u05e4\u05dc \u05d1\u05e4\u05e2\u05d5\u05dc\u05d5\u05ea DB \u05d1\u05d0\u05d5\u05e4\u05df \u05e4\u05e9\u05d5\u05d8.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nvar productRepository = new Repository&lt;Product&gt;(dbContext);\nvar orderRepository = new Repository&lt;Order&gt;(dbContext);\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">Service Response Wrapper<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u05d1\u05d0\u05e4\u05dc\u05d9\u05e7\u05e6\u05d9\u05d5\u05ea \u05e9\u05de\u05e9\u05ea\u05de\u05e9\u05d5\u05ea \u05d1-API \u05d0\u05e0\u05d7\u05e0\u05d5 \u05e9\u05d5\u05dc\u05d7\u05d9\u05dd \u05d7\u05d6\u05e8\u05d4 \u05d0\u05ea \u05d4-response \u05e9\u05d0\u05e0\u05d7\u05e0\u05d5 \u05de\u05e7\u05d1\u05dc\u05d9\u05dd. \u05d0\u05e4\u05e9\u05e8 \u05dc\u05d9\u05e6\u05d5\u05e8 response \u05d2\u05e0\u05e8\u05d9.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\npublic class ServiceResponse&lt;T&gt;\n{\n    public T Data { get; set; }\n    public bool Success { get; set; } = true;\n    public string Message { get; set; } = string.Empty;\n\n    public ServiceResponse() { }\n\n    public ServiceResponse(T data)\n    {\n        Data = data;\n    }\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">\u05e9\u05d9\u05de\u05d5\u05e9 \u05d1-controllers \u05e9\u05de\u05d7\u05d6\u05d9\u05e8\u05d9\u05dd \u05d0\u05ea \u05d4-response.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\npublic ServiceResponse&lt;Product&gt; GetProductById(int id)\n{\n    var product = _productRepository.GetById(id);\n    if (product == null)\n    {\n        return new ServiceResponse&lt;Product&gt;\n        {\n            Success = false,\n            Message = &quot;Product not found&quot;\n        };\n    }\n\n    return new ServiceResponse&lt;Product&gt;(product);\n}\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">Paging and Filtering<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u05d3\u05e4\u05d3\u05d5\u05e3 \u05de\u05d8\u05e4\u05dc \u05d1\u05d4\u05d7\u05d6\u05e8\u05d4 \u05de\u05d3\u05d5\u05e8\u05d2\u05ea \u05e9\u05dc \u05db\u05de\u05d5\u05ea \u05d2\u05d3\u05d5\u05dc\u05d4 \u05e9\u05dc \u05e8\u05e9\u05d5\u05de\u05d5\u05ea. \u05d0\u05e4\u05e9\u05e8 \u05dc\u05d9\u05e6\u05d5\u05e8 \u05d3\u05e4\u05d3\u05e3 \u05d2\u05e0\u05e8\u05d9.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\npublic class PagedResult&lt;T&gt;\n{\n    public IEnumerable&lt;T&gt; Items { get; set; }\n    public int TotalCount { get; set; }\n    public int PageSize { get; set; }\n    public int CurrentPage { get; set; }\n\n    public PagedResult(IEnumerable&lt;T&gt; items, int totalCount, int pageSize, int currentPage)\n    {\n        Items = items;\n        TotalCount = totalCount;\n        PageSize = pageSize;\n        CurrentPage = currentPage;\n    }\n}\n\npublic class PagingHelper\n{\n    public static PagedResult&lt;T&gt; GetPagedResult&lt;T&gt;(IQueryable&lt;T&gt; query, int page, int pageSize)\n    {\n        var totalCount = query.Count();\n        var items = query.Skip((page - 1) * pageSize).Take(pageSize).ToList();\n\n        return new PagedResult&lt;T&gt;(items, totalCount, pageSize, page);\n    }\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">\u05e9\u05d9\u05de\u05d5\u05e9.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nvar pagedProducts = PagingHelper.GetPagedResult(_context.Products, page: 1, pageSize: 10);\nvar pagedOrders = PagingHelper.GetPagedResult(_context.Orders, page: 2, pageSize: 5);\n<\/pre><\/div>","protected":false},"excerpt":{"rendered":"<p>\u05d0\u05d7\u05ea \u05d4\u05d3\u05d5\u05d2\u05de\u05d0\u05d5\u05ea \u05d4\u05e9\u05db\u05d9\u05d7\u05d5\u05ea \u05dc-Generics \u05d4\u05d9\u05d0 \u05d4-List. \u05d0\u05e0\u05d7\u05e0\u05d5 \u05d9\u05db\u05d5\u05dc\u05d9\u05dd \u05dc\u05d9\u05e6\u05d5\u05e8 List \u05de\u05e1\u05d5\u05d2\u05d9\u05dd \u05e9\u05d5\u05e0\u05d9\u05dd. int \u05e9\u05d5\u05e0\u05d4 \u05de-string \u05d5\u05d1\u05db\u05dc \u05d6\u05d0\u05ea \u05d5\u05dc\u05e9\u05e0\u05d9\u05d4\u05dd \u05d0\u05e0\u05d7\u05e0\u05d5 \u05de\u05e9\u05ea\u05de\u05e9\u05d9\u05dd \u05d1-List. \u05d0\u05dd \u05e0\u05e9\u05d9\u05dd \u05e2\u05e8\u05da \u05de\u05e1\u05d5\u05d2 \u05e9\u05d5\u05e0\u05d4 \u05de\u05d6\u05d4 \u05e9\u05dc \u05e1\u05d5\u05d2 \u05d4\u05de\u05d5\u05d2\u05d3\u05e8, \u05d4\u05e7\u05d5\u05de\u05e4\u05d9\u05d9\u05dc\u05e8 \u05d9\u05e6\u05e2\u05e7. \u05e0\u05d5\u05db\u05dc \u05d2\u05dd \u05dc\u05d4\u05d2\u05d3\u05d9\u05e8 List \u05de\u05e1\u05d5\u05d2 object \u05d5\u05d6\u05d4 \u05d9\u05e2\u05d1\u05d5\u05d3, \u05db\u05d9 \u05db\u05dc \u05d3\u05d1\u05e8 \u05d4\u05d5\u05d0 object: \u05d4\u05d2\u05d3\u05e8\u05d4 \u05db\u05d6\u05d0\u05ea \u05dc\u05d0 \u05ea\u05d4\u05d9\u05d4 \u05d9\u05e2\u05d9\u05dc\u05d4 \u05db\u05d9 \u05d4\u05e2\u05e8\u05db\u05d9\u05dd \u05d9\u05d5\u05de\u05e8\u05d5 \u05dc\u05d0\u05d5\u05d1\u05d9\u05d9\u05e7\u05d8\u05d9\u05dd \u05d5\u05d9\u05d1\u05d6\u05d1\u05d6\u05d5 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ocean_post_layout":"","ocean_both_sidebars_style":"","ocean_both_sidebars_content_width":0,"ocean_both_sidebars_sidebars_width":0,"ocean_sidebar":"","ocean_second_sidebar":"","ocean_disable_margins":"enable","ocean_add_body_class":"","ocean_shortcode_before_top_bar":"","ocean_shortcode_after_top_bar":"","ocean_shortcode_before_header":"","ocean_shortcode_after_header":"","ocean_has_shortcode":"","ocean_shortcode_after_title":"","ocean_shortcode_before_footer_widgets":"","ocean_shortcode_after_footer_widgets":"","ocean_shortcode_before_footer_bottom":"","ocean_shortcode_after_footer_bottom":"","ocean_display_top_bar":"default","ocean_display_header":"default","ocean_header_style":"","ocean_center_header_left_menu":"","ocean_custom_header_template":"","ocean_custom_logo":0,"ocean_custom_retina_logo":0,"ocean_custom_logo_max_width":0,"ocean_custom_logo_tablet_max_width":0,"ocean_custom_logo_mobile_max_width":0,"ocean_custom_logo_max_height":0,"ocean_custom_logo_tablet_max_height":0,"ocean_custom_logo_mobile_max_height":0,"ocean_header_custom_menu":"","ocean_menu_typo_font_family":"","ocean_menu_typo_font_subset":"","ocean_menu_typo_font_size":0,"ocean_menu_typo_font_size_tablet":0,"ocean_menu_typo_font_size_mobile":0,"ocean_menu_typo_font_size_unit":"px","ocean_menu_typo_font_weight":"","ocean_menu_typo_font_weight_tablet":"","ocean_menu_typo_font_weight_mobile":"","ocean_menu_typo_transform":"","ocean_menu_typo_transform_tablet":"","ocean_menu_typo_transform_mobile":"","ocean_menu_typo_line_height":0,"ocean_menu_typo_line_height_tablet":0,"ocean_menu_typo_line_height_mobile":0,"ocean_menu_typo_line_height_unit":"","ocean_menu_typo_spacing":0,"ocean_menu_typo_spacing_tablet":0,"ocean_menu_typo_spacing_mobile":0,"ocean_menu_typo_spacing_unit":"","ocean_menu_link_color":"","ocean_menu_link_color_hover":"","ocean_menu_link_color_active":"","ocean_menu_link_background":"","ocean_menu_link_hover_background":"","ocean_menu_link_active_background":"","ocean_menu_social_links_bg":"","ocean_menu_social_hover_links_bg":"","ocean_menu_social_links_color":"","ocean_menu_social_hover_links_color":"","ocean_disable_title":"default","ocean_disable_heading":"default","ocean_post_title":"","ocean_post_subheading":"","ocean_post_title_style":"","ocean_post_title_background_color":"","ocean_post_title_background":0,"ocean_post_title_bg_image_position":"","ocean_post_title_bg_image_attachment":"","ocean_post_title_bg_image_repeat":"","ocean_post_title_bg_image_size":"","ocean_post_title_height":0,"ocean_post_title_bg_overlay":0.5,"ocean_post_title_bg_overlay_color":"","ocean_disable_breadcrumbs":"default","ocean_breadcrumbs_color":"","ocean_breadcrumbs_separator_color":"","ocean_breadcrumbs_links_color":"","ocean_breadcrumbs_links_hover_color":"","ocean_display_footer_widgets":"default","ocean_display_footer_bottom":"default","ocean_custom_footer_template":"","_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"ocean_post_oembed":"","ocean_post_self_hosted_media":"","ocean_post_video_embed":"","ocean_link_format":"","ocean_link_format_target":"self","ocean_quote_format":"","ocean_quote_format_link":"post","ocean_gallery_link_images":"on","ocean_gallery_id":[],"footnotes":""},"categories":[76],"tags":[],"class_list":["post-1929","post","type-post","status-publish","format-standard","hentry","category-advanced-c-sharp","entry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>C# Generics - Code Notebook<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/epicmarketing.co.il\/notebook\/c-generics\/\" \/>\n<meta property=\"og:locale\" content=\"he_IL\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"C# Generics - Code Notebook\" \/>\n<meta property=\"og:description\" content=\"\u05d0\u05d7\u05ea \u05d4\u05d3\u05d5\u05d2\u05de\u05d0\u05d5\u05ea \u05d4\u05e9\u05db\u05d9\u05d7\u05d5\u05ea \u05dc-Generics \u05d4\u05d9\u05d0 \u05d4-List. \u05d0\u05e0\u05d7\u05e0\u05d5 \u05d9\u05db\u05d5\u05dc\u05d9\u05dd \u05dc\u05d9\u05e6\u05d5\u05e8 List \u05de\u05e1\u05d5\u05d2\u05d9\u05dd \u05e9\u05d5\u05e0\u05d9\u05dd. int \u05e9\u05d5\u05e0\u05d4 \u05de-string \u05d5\u05d1\u05db\u05dc \u05d6\u05d0\u05ea \u05d5\u05dc\u05e9\u05e0\u05d9\u05d4\u05dd \u05d0\u05e0\u05d7\u05e0\u05d5 \u05de\u05e9\u05ea\u05de\u05e9\u05d9\u05dd \u05d1-List. \u05d0\u05dd \u05e0\u05e9\u05d9\u05dd \u05e2\u05e8\u05da \u05de\u05e1\u05d5\u05d2 \u05e9\u05d5\u05e0\u05d4 \u05de\u05d6\u05d4 \u05e9\u05dc \u05e1\u05d5\u05d2 \u05d4\u05de\u05d5\u05d2\u05d3\u05e8, \u05d4\u05e7\u05d5\u05de\u05e4\u05d9\u05d9\u05dc\u05e8 \u05d9\u05e6\u05e2\u05e7. \u05e0\u05d5\u05db\u05dc \u05d2\u05dd \u05dc\u05d4\u05d2\u05d3\u05d9\u05e8 List \u05de\u05e1\u05d5\u05d2 object \u05d5\u05d6\u05d4 \u05d9\u05e2\u05d1\u05d5\u05d3, \u05db\u05d9 \u05db\u05dc \u05d3\u05d1\u05e8 \u05d4\u05d5\u05d0 object: \u05d4\u05d2\u05d3\u05e8\u05d4 \u05db\u05d6\u05d0\u05ea \u05dc\u05d0 \u05ea\u05d4\u05d9\u05d4 \u05d9\u05e2\u05d9\u05dc\u05d4 \u05db\u05d9 \u05d4\u05e2\u05e8\u05db\u05d9\u05dd \u05d9\u05d5\u05de\u05e8\u05d5 \u05dc\u05d0\u05d5\u05d1\u05d9\u05d9\u05e7\u05d8\u05d9\u05dd \u05d5\u05d9\u05d1\u05d6\u05d1\u05d6\u05d5 [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/epicmarketing.co.il\/notebook\/c-generics\/\" \/>\n<meta property=\"og:site_name\" content=\"Code Notebook\" \/>\n<meta property=\"article:published_time\" content=\"2024-10-30T04:32:54+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-10-31T10:32:33+00:00\" \/>\n<meta name=\"author\" content=\"kerendanino\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u05e0\u05db\u05ea\u05d1 \u05e2\u05dc \u05d9\u05d3\" \/>\n\t<meta name=\"twitter:data1\" content=\"kerendanino\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u05d6\u05de\u05df \u05e7\u05e8\u05d9\u05d0\u05d4 \u05de\u05d5\u05e2\u05e8\u05da\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u05d3\u05e7\u05d5\u05ea\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/epicmarketing.co.il\\\/notebook\\\/c-generics\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/epicmarketing.co.il\\\/notebook\\\/c-generics\\\/\"},\"author\":{\"name\":\"kerendanino\",\"@id\":\"https:\\\/\\\/epicmarketing.co.il\\\/notebook\\\/#\\\/schema\\\/person\\\/195dfc625818eadda7903d456890e24c\"},\"headline\":\"C# Generics\",\"datePublished\":\"2024-10-30T04:32:54+00:00\",\"dateModified\":\"2024-10-31T10:32:33+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/epicmarketing.co.il\\\/notebook\\\/c-generics\\\/\"},\"wordCount\":72,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/epicmarketing.co.il\\\/notebook\\\/#organization\"},\"articleSection\":[\"C# \u05dc\u05de\u05ea\u05e7\u05d3\u05de\u05d9\u05dd\"],\"inLanguage\":\"he-IL\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/epicmarketing.co.il\\\/notebook\\\/c-generics\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/epicmarketing.co.il\\\/notebook\\\/c-generics\\\/\",\"url\":\"https:\\\/\\\/epicmarketing.co.il\\\/notebook\\\/c-generics\\\/\",\"name\":\"C# Generics - Code Notebook\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/epicmarketing.co.il\\\/notebook\\\/#website\"},\"datePublished\":\"2024-10-30T04:32:54+00:00\",\"dateModified\":\"2024-10-31T10:32:33+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/epicmarketing.co.il\\\/notebook\\\/c-generics\\\/#breadcrumb\"},\"inLanguage\":\"he-IL\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/epicmarketing.co.il\\\/notebook\\\/c-generics\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/epicmarketing.co.il\\\/notebook\\\/c-generics\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/epicmarketing.co.il\\\/notebook\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"C# Generics\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/epicmarketing.co.il\\\/notebook\\\/#website\",\"url\":\"https:\\\/\\\/epicmarketing.co.il\\\/notebook\\\/\",\"name\":\"Code Notebook\",\"description\":\"Easy coding\",\"publisher\":{\"@id\":\"https:\\\/\\\/epicmarketing.co.il\\\/notebook\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/epicmarketing.co.il\\\/notebook\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"he-IL\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/epicmarketing.co.il\\\/notebook\\\/#organization\",\"name\":\"Code Notebook\",\"url\":\"https:\\\/\\\/epicmarketing.co.il\\\/notebook\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"he-IL\",\"@id\":\"https:\\\/\\\/epicmarketing.co.il\\\/notebook\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/epicmarketing.co.il\\\/notebook\\\/wp-content\\\/uploads\\\/2023\\\/07\\\/logo-epic-marketing-05.png\",\"contentUrl\":\"https:\\\/\\\/epicmarketing.co.il\\\/notebook\\\/wp-content\\\/uploads\\\/2023\\\/07\\\/logo-epic-marketing-05.png\",\"width\":3626,\"height\":1942,\"caption\":\"Code Notebook\"},\"image\":{\"@id\":\"https:\\\/\\\/epicmarketing.co.il\\\/notebook\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/epicmarketing.co.il\\\/notebook\\\/#\\\/schema\\\/person\\\/195dfc625818eadda7903d456890e24c\",\"name\":\"kerendanino\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"he-IL\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/285cc9389c66aa46da1e26a474b1e90e9efaf3fa21f1b928cbd63ce5f0e89c63?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/285cc9389c66aa46da1e26a474b1e90e9efaf3fa21f1b928cbd63ce5f0e89c63?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/285cc9389c66aa46da1e26a474b1e90e9efaf3fa21f1b928cbd63ce5f0e89c63?s=96&d=mm&r=g\",\"caption\":\"kerendanino\"},\"url\":\"https:\\\/\\\/epicmarketing.co.il\\\/notebook\\\/author\\\/kerendanino\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"C# Generics - Code Notebook","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/epicmarketing.co.il\/notebook\/c-generics\/","og_locale":"he_IL","og_type":"article","og_title":"C# Generics - Code Notebook","og_description":"\u05d0\u05d7\u05ea \u05d4\u05d3\u05d5\u05d2\u05de\u05d0\u05d5\u05ea \u05d4\u05e9\u05db\u05d9\u05d7\u05d5\u05ea \u05dc-Generics \u05d4\u05d9\u05d0 \u05d4-List. \u05d0\u05e0\u05d7\u05e0\u05d5 \u05d9\u05db\u05d5\u05dc\u05d9\u05dd \u05dc\u05d9\u05e6\u05d5\u05e8 List \u05de\u05e1\u05d5\u05d2\u05d9\u05dd \u05e9\u05d5\u05e0\u05d9\u05dd. int \u05e9\u05d5\u05e0\u05d4 \u05de-string \u05d5\u05d1\u05db\u05dc \u05d6\u05d0\u05ea \u05d5\u05dc\u05e9\u05e0\u05d9\u05d4\u05dd \u05d0\u05e0\u05d7\u05e0\u05d5 \u05de\u05e9\u05ea\u05de\u05e9\u05d9\u05dd \u05d1-List. \u05d0\u05dd \u05e0\u05e9\u05d9\u05dd \u05e2\u05e8\u05da \u05de\u05e1\u05d5\u05d2 \u05e9\u05d5\u05e0\u05d4 \u05de\u05d6\u05d4 \u05e9\u05dc \u05e1\u05d5\u05d2 \u05d4\u05de\u05d5\u05d2\u05d3\u05e8, \u05d4\u05e7\u05d5\u05de\u05e4\u05d9\u05d9\u05dc\u05e8 \u05d9\u05e6\u05e2\u05e7. \u05e0\u05d5\u05db\u05dc \u05d2\u05dd \u05dc\u05d4\u05d2\u05d3\u05d9\u05e8 List \u05de\u05e1\u05d5\u05d2 object \u05d5\u05d6\u05d4 \u05d9\u05e2\u05d1\u05d5\u05d3, \u05db\u05d9 \u05db\u05dc \u05d3\u05d1\u05e8 \u05d4\u05d5\u05d0 object: \u05d4\u05d2\u05d3\u05e8\u05d4 \u05db\u05d6\u05d0\u05ea \u05dc\u05d0 \u05ea\u05d4\u05d9\u05d4 \u05d9\u05e2\u05d9\u05dc\u05d4 \u05db\u05d9 \u05d4\u05e2\u05e8\u05db\u05d9\u05dd \u05d9\u05d5\u05de\u05e8\u05d5 \u05dc\u05d0\u05d5\u05d1\u05d9\u05d9\u05e7\u05d8\u05d9\u05dd \u05d5\u05d9\u05d1\u05d6\u05d1\u05d6\u05d5 [&hellip;]","og_url":"https:\/\/epicmarketing.co.il\/notebook\/c-generics\/","og_site_name":"Code Notebook","article_published_time":"2024-10-30T04:32:54+00:00","article_modified_time":"2024-10-31T10:32:33+00:00","author":"kerendanino","twitter_card":"summary_large_image","twitter_misc":{"\u05e0\u05db\u05ea\u05d1 \u05e2\u05dc \u05d9\u05d3":"kerendanino","\u05d6\u05de\u05df \u05e7\u05e8\u05d9\u05d0\u05d4 \u05de\u05d5\u05e2\u05e8\u05da":"2 \u05d3\u05e7\u05d5\u05ea"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/epicmarketing.co.il\/notebook\/c-generics\/#article","isPartOf":{"@id":"https:\/\/epicmarketing.co.il\/notebook\/c-generics\/"},"author":{"name":"kerendanino","@id":"https:\/\/epicmarketing.co.il\/notebook\/#\/schema\/person\/195dfc625818eadda7903d456890e24c"},"headline":"C# Generics","datePublished":"2024-10-30T04:32:54+00:00","dateModified":"2024-10-31T10:32:33+00:00","mainEntityOfPage":{"@id":"https:\/\/epicmarketing.co.il\/notebook\/c-generics\/"},"wordCount":72,"commentCount":0,"publisher":{"@id":"https:\/\/epicmarketing.co.il\/notebook\/#organization"},"articleSection":["C# \u05dc\u05de\u05ea\u05e7\u05d3\u05de\u05d9\u05dd"],"inLanguage":"he-IL","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/epicmarketing.co.il\/notebook\/c-generics\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/epicmarketing.co.il\/notebook\/c-generics\/","url":"https:\/\/epicmarketing.co.il\/notebook\/c-generics\/","name":"C# Generics - Code Notebook","isPartOf":{"@id":"https:\/\/epicmarketing.co.il\/notebook\/#website"},"datePublished":"2024-10-30T04:32:54+00:00","dateModified":"2024-10-31T10:32:33+00:00","breadcrumb":{"@id":"https:\/\/epicmarketing.co.il\/notebook\/c-generics\/#breadcrumb"},"inLanguage":"he-IL","potentialAction":[{"@type":"ReadAction","target":["https:\/\/epicmarketing.co.il\/notebook\/c-generics\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/epicmarketing.co.il\/notebook\/c-generics\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/epicmarketing.co.il\/notebook\/"},{"@type":"ListItem","position":2,"name":"C# Generics"}]},{"@type":"WebSite","@id":"https:\/\/epicmarketing.co.il\/notebook\/#website","url":"https:\/\/epicmarketing.co.il\/notebook\/","name":"Code Notebook","description":"Easy coding","publisher":{"@id":"https:\/\/epicmarketing.co.il\/notebook\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/epicmarketing.co.il\/notebook\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"he-IL"},{"@type":"Organization","@id":"https:\/\/epicmarketing.co.il\/notebook\/#organization","name":"Code Notebook","url":"https:\/\/epicmarketing.co.il\/notebook\/","logo":{"@type":"ImageObject","inLanguage":"he-IL","@id":"https:\/\/epicmarketing.co.il\/notebook\/#\/schema\/logo\/image\/","url":"https:\/\/epicmarketing.co.il\/notebook\/wp-content\/uploads\/2023\/07\/logo-epic-marketing-05.png","contentUrl":"https:\/\/epicmarketing.co.il\/notebook\/wp-content\/uploads\/2023\/07\/logo-epic-marketing-05.png","width":3626,"height":1942,"caption":"Code Notebook"},"image":{"@id":"https:\/\/epicmarketing.co.il\/notebook\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/epicmarketing.co.il\/notebook\/#\/schema\/person\/195dfc625818eadda7903d456890e24c","name":"kerendanino","image":{"@type":"ImageObject","inLanguage":"he-IL","@id":"https:\/\/secure.gravatar.com\/avatar\/285cc9389c66aa46da1e26a474b1e90e9efaf3fa21f1b928cbd63ce5f0e89c63?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/285cc9389c66aa46da1e26a474b1e90e9efaf3fa21f1b928cbd63ce5f0e89c63?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/285cc9389c66aa46da1e26a474b1e90e9efaf3fa21f1b928cbd63ce5f0e89c63?s=96&d=mm&r=g","caption":"kerendanino"},"url":"https:\/\/epicmarketing.co.il\/notebook\/author\/kerendanino\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/epicmarketing.co.il\/notebook\/wp-json\/wp\/v2\/posts\/1929","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/epicmarketing.co.il\/notebook\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/epicmarketing.co.il\/notebook\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/epicmarketing.co.il\/notebook\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/epicmarketing.co.il\/notebook\/wp-json\/wp\/v2\/comments?post=1929"}],"version-history":[{"count":4,"href":"https:\/\/epicmarketing.co.il\/notebook\/wp-json\/wp\/v2\/posts\/1929\/revisions"}],"predecessor-version":[{"id":1934,"href":"https:\/\/epicmarketing.co.il\/notebook\/wp-json\/wp\/v2\/posts\/1929\/revisions\/1934"}],"wp:attachment":[{"href":"https:\/\/epicmarketing.co.il\/notebook\/wp-json\/wp\/v2\/media?parent=1929"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/epicmarketing.co.il\/notebook\/wp-json\/wp\/v2\/categories?post=1929"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/epicmarketing.co.il\/notebook\/wp-json\/wp\/v2\/tags?post=1929"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}