summaryrefslogtreecommitdiffhomepage
path: root/csharp.html.markdown
diff options
context:
space:
mode:
Diffstat (limited to 'csharp.html.markdown')
-rw-r--r--csharp.html.markdown23
1 files changed, 20 insertions, 3 deletions
diff --git a/csharp.html.markdown b/csharp.html.markdown
index 136f6c50..47dd9683 100644
--- a/csharp.html.markdown
+++ b/csharp.html.markdown
@@ -508,7 +508,7 @@ on a new line! ""Wow!"", the masses cried";
// LINQ - maps a store to IQueryable<T> objects, with delayed execution
// e.g. LinqToSql - maps to a database, LinqToXml maps to an xml document
- var db = new BikeRespository();
+ var db = new BikeRepository();
// execution is delayed, which is great when querying a database
var filter = db.Bikes.Where(b => b.HasTassles); // no query run
@@ -678,6 +678,23 @@ on a new line! ""Wow!"", the masses cried";
private set;
}
+ // It's also possible to define custom Indexers on objects.
+ // All though this is not entirely useful in this example, you
+ // could do bicycle[0] which yields "chris" to get the first passenger or
+ // bicycle[1] = "lisa" to set the passenger. (of this apparent quattrocycle)
+ private string[] passengers = { "chris", "phil", "darren", "regina" }
+
+ public string this[int i]
+ {
+ get {
+ return passengers[i];
+ }
+
+ set {
+ return passengers[i] = value;
+ }
+ }
+
//Method to display the attribute values of this Object.
public virtual string Info()
{
@@ -767,9 +784,9 @@ on a new line! ""Wow!"", the masses cried";
/// EntityFramework Code First is awesome (similar to Ruby's ActiveRecord, but bidirectional)
/// http://msdn.microsoft.com/en-us/data/jj193542.aspx
/// </summary>
- public class BikeRespository : DbSet
+ public class BikeRepository : DbSet
{
- public BikeRespository()
+ public BikeRepository()
: base()
{
}