Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think there's two consents here you don't understand (or I simply don't understand your question).</p> <p><code>this[..]</code> properties are index-properties. They are used like array-expressions. For instance, you could imagine creating your own "array" like this:</p> <pre><code>public class MyArray { string[] _storrage = new string[100]; public string this[int index] { get { return _storrage[index]; } set { _storrage[index] = value; } } } </code></pre> <p>You can create index-properties with multiple arguments as well, and they can be overloaded. For instance, some lists allows you to access items either by name (<code>this[string name]</code>) and index (<code>this[int index]</code>). In all actuality it's just syntactic sugar so you don't have to write methods like <code>getItem(int index)</code> as you do in java.</p> <p>The other consept that it seems you're not understanding (though not apparent from your question) is lambda-methods. In your code:</p> <pre><code>(item) =&gt; item.GetSelectLink(item.Id) </code></pre> <p>is a lambda-method. For instance if the method <code>Colum</code> on your <code>grid</code>-object has the following signature:</p> <pre><code>public void Column&lt;T&gt;(string name, Func&lt;T, string&gt;) </code></pre> <p>the expression <code>(item) =&gt; item.GetSelectLink(item.Id)</code> would evaluate to a method that takes a <code>T</code> and returns a string. An alternative way to create the same functionality is to do this:</p> <pre><code>// in class public string GetIdField(YourClassType item) { return item.GetSelectLink(item.Id); } // in Column-call grid.Column("Id", format: GetIdField); </code></pre> <p>You can read more about lambdas here: <a href="http://msdn.microsoft.com/en-us/library/vstudio/bb397687.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/vstudio/bb397687.aspx</a></p> <p><strong>[Edit]</strong><br> To show a quick example of a lambda that might shred some light on this:</p> <pre><code>var list = new List&lt;string&gt;() { "a", "b", "c" }; list.ForEach((item) =&gt; Console.WriteLine(item)); </code></pre> <p>this will output "a", "b" and "c" (see it run at <a href="http://ideone.com/MGZxfr" rel="nofollow">http://ideone.com/MGZxfr</a>). The equivalent (without using a lambda) would be something like this:</p> <pre><code>void Main() { var list = new List&lt;string&gt;() { "a", "b", "c" }; foreach(var item in list) Print(item); } void Print(string item) { Console.WriteLine(item); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload