<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[חיפוש רק חלק מהמילה]]></title><description><![CDATA[<p dir="auto">אני כותב חלון חיפוש, ואני רוצה שהוא יציג לי תוצאה גם אם היא שווה רק בחלק מהמילה,<br />
כלומר גם אם הוא יכתוב רק "אבר" זה יציג גם את "אברהם".<br />
אני משתמש בlist to Object<br />
תודה רבה!</p>
<p dir="auto"><em>פורסם במקור בפורום CODE613 ב07/08/2015 16:26 (+03:00)</em></p>
]]></description><link>https://tchumim.com/topic/757/חיפוש-רק-חלק-מהמילה</link><generator>RSS for Node</generator><lastBuildDate>Wed, 13 May 2026 04:12:54 GMT</lastBuildDate><atom:link href="https://tchumim.com/topic/757.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 29 Jan 2018 11:08:41 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to חיפוש רק חלק מהמילה on Mon, 29 Jan 2018 11:08:46 GMT]]></title><description><![CDATA[<p dir="auto">בעזרת האופרטור ?? (null-coalescing)</p>
<pre><code>foreach (Donor donor in AddTorem.donors)
            {
               if ((donor.Email ?? "").Contains(email))
                result.Add(donor);   
            }
</code></pre>
<p dir="auto"><em>פורסם במקור בפורום CODE613 ב09/08/2015 13:45 (+03:00)</em></p>
]]></description><link>https://tchumim.com/post/4842</link><guid isPermaLink="true">https://tchumim.com/post/4842</guid><dc:creator><![CDATA[softs]]></dc:creator><pubDate>Mon, 29 Jan 2018 11:08:46 GMT</pubDate></item><item><title><![CDATA[Reply to חיפוש רק חלק מהמילה on Mon, 29 Jan 2018 11:08:45 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/softs">@<bdi>softs</bdi></a></p>
<blockquote>
<p dir="auto">והנה פשוט יותר עם linq  <img src="https://tchumim.com/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=9d71ebe86e6" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" style="height:23px;width:auto;vertical-align:middle" title=":)" alt="🙂" /></p>
</blockquote>
<p dir="auto">אני רוצה להוסיף תנאי שיבדוק קודם לכן שהערך אינו null<br />
כתבתי כך בלי להשתמש בlinq:</p>
<pre><code>public static IEnumerable&lt;Donor&gt; SearchEmail(string email)
        {
            var result = new List&lt;Donor&gt;();
            foreach (Donor donor in AddTorem.donors)
            {
                if (donor.Email != null)
                {
                    if (donor.Email.Contains(email))
                        result.Add(donor);
                }                
            }
            return (IEnumerable&lt;Donor&gt;)result;
        }
</code></pre>
<p dir="auto">השאלה האם יש דרך לכתוב זאת עם לינק?<br />
תודה</p>
<p dir="auto"><em>פורסם במקור בפורום CODE613 ב09/08/2015 12:41 (+03:00)</em></p>
]]></description><link>https://tchumim.com/post/4841</link><guid isPermaLink="true">https://tchumim.com/post/4841</guid><dc:creator><![CDATA[avr416]]></dc:creator><pubDate>Mon, 29 Jan 2018 11:08:45 GMT</pubDate></item><item><title><![CDATA[Reply to חיפוש רק חלק מהמילה on Mon, 29 Jan 2018 11:08:45 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/softs">@<bdi>softs</bdi></a></p>
<blockquote>
<p dir="auto">והנה פשוט יותר עם linq  <img src="https://tchumim.com/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=9d71ebe86e6" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" style="height:23px;width:auto;vertical-align:middle" title=":)" alt="🙂" /></p>
<pre><code>public static IEnumerable&lt;Donor&gt; SearchName(IEnumerable&lt;Donor&gt; lst, string sName)
{
     return lst.Where(d =&gt; d.FirstName == sName || d.LastName == sName);
}
</code></pre>
</blockquote>
<p dir="auto">התכוונת כמובן לכתוב כך::</p>
<pre><code>return list.Where(d =&gt; d.FirstName.Contains(name)  || d.LastName.Contains(name));
</code></pre>
<p dir="auto">כי איך שכתבת זה מחפש רק כאשר כל הסטרינג מופיע במאפיין..</p>
<p dir="auto"><em>פורסם במקור בפורום CODE613 ב09/08/2015 11:26 (+03:00)</em></p>
]]></description><link>https://tchumim.com/post/4840</link><guid isPermaLink="true">https://tchumim.com/post/4840</guid><dc:creator><![CDATA[avr416]]></dc:creator><pubDate>Mon, 29 Jan 2018 11:08:45 GMT</pubDate></item><item><title><![CDATA[Reply to חיפוש רק חלק מהמילה on Mon, 29 Jan 2018 11:08:44 GMT]]></title><description><![CDATA[<p dir="auto">והנה פשוט יותר עם linq  <img src="https://tchumim.com/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=9d71ebe86e6" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" style="height:23px;width:auto;vertical-align:middle" title=":)" alt="🙂" /></p>
<pre><code>public static IEnumerable&lt;Donor&gt; SearchName(IEnumerable&lt;Donor&gt; lst, string sName)
{
     return lst.Where(d =&gt; d.FirstName == sName || d.LastName == sName);
}
</code></pre>
<p dir="auto"><em>פורסם במקור בפורום CODE613 ב09/08/2015 11:09 (+03:00)</em></p>
]]></description><link>https://tchumim.com/post/4839</link><guid isPermaLink="true">https://tchumim.com/post/4839</guid><dc:creator><![CDATA[softs]]></dc:creator><pubDate>Mon, 29 Jan 2018 11:08:44 GMT</pubDate></item><item><title><![CDATA[Reply to חיפוש רק חלק מהמילה on Mon, 29 Jan 2018 11:08:44 GMT]]></title><description><![CDATA[<p dir="auto">הנה פשוט בלי לינק</p>
<pre><code>public static IEnumerable&lt;Donor&gt; SearchName(string name)
        {
            var result = new List&lt;Donor&gt;();
            foreach (Donor donor in AddTorem.donors)
            {
                if (donor.FirstName.Contains(name) || donor.LastName.Contains(name))
                    result.Add(donor);
            }
            
            return (IEnumerable&lt;Donor&gt;)result;
        }
</code></pre>
<p dir="auto"><em>פורסם במקור בפורום CODE613 ב09/08/2015 08:14 (+03:00)</em></p>
]]></description><link>https://tchumim.com/post/4838</link><guid isPermaLink="true">https://tchumim.com/post/4838</guid><dc:creator><![CDATA[רחמים]]></dc:creator><pubDate>Mon, 29 Jan 2018 11:08:44 GMT</pubDate></item><item><title><![CDATA[Reply to חיפוש רק חלק מהמילה on Mon, 29 Jan 2018 11:08:43 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/clickone">@<bdi>ClickOne</bdi></a></p>
<blockquote>
<pre><code>var resultList = list.FindAll(delegate(string s) { return s.Contains(srch); });
</code></pre>
<p dir="auto"><a href="http://stackoverflow.com/questions/10488587/find-substring-in-a-list-of-strings" target="_blank" rel="noopener noreferrer nofollow ugc">http://stackoverflow.com/questions/10488587/find-substring-in-a-list-of-strings</a></p>
</blockquote>
<p dir="auto">לא בדיוק הבנתי איך אני כותב את זה,<br />
אני משתמש בפונקציה הבאה:</p>
<pre><code>public static IEnumerable&lt;Donor&gt; SearchName(string name)
        {
            var result = from donor in AddTorem.donors
                         where donor.FirstName == name || donor.LastName == name
                         select donor;
            return (IEnumerable&lt;Donor&gt;)result;            
        }
</code></pre>
<p dir="auto">ממה שראיתי בstackoverflow הם דיברו שם על ליסט של סטרינגים, אבל אני מחפש בליסט של אובייקטים ואני רוצה לחפש סטרינג ששוה לאחד מהמאפיינים של האובייקט אז איך אני רושם את זה?<br />
כמו כן האם אפשר הסבר על הדליגייט הזה והפונקציה האנונימית? לא בדיוק הבנתי מה הם עושים.. (הדלגייט מקבל סטרינג והפונקציה בודקת האם הסטרינג מכיל את מילת החיפוש.. זה מה שהבנתי.. )<br />
תודה רבה!</p>
<p dir="auto"><em>פורסם במקור בפורום CODE613 ב09/08/2015 00:07 (+03:00)</em></p>
]]></description><link>https://tchumim.com/post/4837</link><guid isPermaLink="true">https://tchumim.com/post/4837</guid><dc:creator><![CDATA[avr416]]></dc:creator><pubDate>Mon, 29 Jan 2018 11:08:43 GMT</pubDate></item><item><title><![CDATA[Reply to חיפוש רק חלק מהמילה on Mon, 29 Jan 2018 11:08:42 GMT]]></title><description><![CDATA[<p dir="auto">השלב הבא שלך הוא <a href="https://he.wikipedia.org/wiki/%D7%9E%D7%A8%D7%97%D7%A7_%D7%9C%D7%95%D7%99%D7%A0%D7%A9%D7%98%D7%99%D7%99%D7%9F" target="_blank" rel="noopener noreferrer nofollow ugc">זה</a>, ו/או <a href="https://he.wikipedia.org/wiki/%D7%9E%D7%A8%D7%97%D7%A7_%D7%94%D7%9E%D7%99%D7%A0%D7%92" target="_blank" rel="noopener noreferrer nofollow ugc">זה</a> אבל תיזהר מלהשתמש בו כאשר יש לך רשומות רבות מידי (נגיד מעל 10 אלף).</p>
<p dir="auto"><em>פורסם במקור בפורום CODE613 ב08/08/2015 21:23 (+03:00)</em></p>
]]></description><link>https://tchumim.com/post/4836</link><guid isPermaLink="true">https://tchumim.com/post/4836</guid><dc:creator><![CDATA[ארכיטקט]]></dc:creator><pubDate>Mon, 29 Jan 2018 11:08:42 GMT</pubDate></item><item><title><![CDATA[Reply to חיפוש רק חלק מהמילה on Mon, 29 Jan 2018 11:08:41 GMT]]></title><description><![CDATA[<pre><code>var resultList = list.FindAll(delegate(string s) { return s.Contains(srch); });
</code></pre>
<p dir="auto"><a href="http://stackoverflow.com/questions/10488587/find-substring-in-a-list-of-strings" target="_blank" rel="noopener noreferrer nofollow ugc">http://stackoverflow.com/questions/10488587/find-substring-in-a-list-of-strings</a></p>
<p dir="auto"><em>פורסם במקור בפורום CODE613 ב07/08/2015 17:55 (+03:00)</em></p>
]]></description><link>https://tchumim.com/post/4835</link><guid isPermaLink="true">https://tchumim.com/post/4835</guid><dc:creator><![CDATA[clickone]]></dc:creator><pubDate>Mon, 29 Jan 2018 11:08:41 GMT</pubDate></item></channel></rss>