Created
August 17, 2013 20:38
-
-
Save xivSolutions/6258586 to your computer and use it in GitHub Desktop.
Coding styles used in original Massive vs. alpha revisions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1. Coding Style? | |
// RUBY STYLE Your newer additions seem to take on a Ruby-like (2 space indent) style: | |
public static void CloneFromObject(this object o, object record) { | |
var props = o.GetType().GetProperties(); | |
var dictionary = record.ToDictionary(); | |
foreach (var prop in props) { | |
var propName = prop.Name; | |
foreach (var key in dictionary.Keys) { | |
if(key.Equals(propName,StringComparison.InvariantCultureIgnoreCase)){ | |
prop.SetValue(o,dictionary[key]); | |
} | |
} | |
} | |
} | |
// The rest of the code seems to have become a mix between the three styles described below: | |
// STYLE 1 (All opening brackets in-line): | |
/// <summary> | |
/// Turns an IDataReader to a Dynamic list of things | |
/// </summary> | |
public static List<dynamic> ToExpandoList(this IDataReader rdr) { | |
var result = new List<dynamic>(); | |
while (rdr.Read()) { | |
result.Add(rdr.RecordToExpando()); | |
} | |
return result; | |
} | |
// STYLE 2 (opening Brackets in-line except for method opening_ : | |
/// <summary> | |
/// Turns an IDataReader to a Dynamic list of things | |
/// </summary> | |
public static List<dynamic> ToExpandoList(this IDataReader rdr) | |
{ | |
var result = new List<dynamic>(); | |
while (rdr.Read()) { | |
result.Add(rdr.RecordToExpando()); | |
} | |
return result; | |
} | |
// STYLE 3 (all brackets own line): | |
/// <summary> | |
/// Turns an IDataReader to a Dynamic list of things | |
/// </summary> | |
public static List<dynamic> ToExpandoList(this IDataReader rdr) | |
{ | |
var result = new List<dynamic>(); | |
while (rdr.Read()) | |
{ | |
result.Add(rdr.RecordToExpando()); | |
} | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment