This file contains 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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace CodeReadability | |
{ | |
public class CyclomaticComplexity | |
{ |
This file contains 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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
namespace CodeReadability | |
{ | |
public class Arithmetic | |
{ | |
public static int FirstProcessNumberA(int number) | |
{ |
This file contains 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
<#@ template language="C#" debug="false" hostspecific="true"#> | |
<#@ include file="EF.Utility.CS.ttinclude"#><#@ | |
output extension=".cs"#><# | |
const string inputFile = @"..\WebPortal.Domain\Entities.edmx"; | |
var textTransform = DynamicTextTransformation.Create(this); | |
var code = new CodeGenerationTools(this); | |
var ef = new MetadataTools(this); | |
var typeMapper = new TypeMapper(code, ef, textTransform.Errors); | |
var fileManager = EntityFrameworkTemplateFileManager.Create(this); |
This file contains 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
<#@ template language="C#" debug="false" hostspecific="true"#> | |
<#@ include file="EF.Utility.CS.ttinclude"#><#@ | |
output extension=".cs"#><# | |
const string inputFile = @"Entities.edmx"; | |
var textTransform = DynamicTextTransformation.Create(this); | |
var code = new CodeGenerationTools(this); | |
var ef = new MetadataTools(this); | |
var typeMapper = new TypeMapper(code, ef, textTransform.Errors); | |
var fileManager = EntityFrameworkTemplateFileManager.Create(this); |
This file contains 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
<#@ template language="C#" debug="false" hostspecific="true"#> | |
<#@ include file="EF.Utility.CS.ttinclude"#><#@ | |
output extension=".cs"#><# | |
const string inputFile = @"Entities.edmx"; | |
var textTransform = DynamicTextTransformation.Create(this); | |
var code = new CodeGenerationTools(this); | |
var ef = new MetadataTools(this); | |
var typeMapper = new TypeMapper(code, ef, textTransform.Errors); | |
var loader = new EdmMetadataLoader(textTransform.Host, textTransform.Errors); |
This file contains 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
static void Main(string[] args) | |
{ | |
var factory = new MailPieceFactory(); | |
var zipCodes = new List<int>(); | |
for (int index = 0; index < 23458333; index++) | |
{ | |
zipCodes.Add(index % 100000); | |
var randomPiece = factory.GetPiece(GetRandomKey()); | |
string pieceStatistics = randomPiece.GetStatistics(zipCodes[index]); |
This file contains 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
public class MailPieceFactory | |
{ | |
private readonly Dictionary<char, MailPiece> _mailPieces = new Dictionary<char,MailPiece>(); | |
public MailPiece GetPiece(char key) | |
{ | |
if (!_mailPieces.ContainsKey(key)) | |
_mailPieces[key] = BuildPiece(key); | |
return _mailPieces[key]; |
This file contains 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
static void Main(string[] args) | |
{ | |
var zipCodes = new List<int>(); | |
var letter = new Letter(); | |
for (int index = 0; index < 23458333; index++) | |
{ | |
zipCodes.Add(index % 100000); | |
string pieceStatistics = letter.GetStatistics(zipCodes[index]); | |
Console.Write(pieceStatistics); | |
} |
This file contains 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
public abstract class MailPiece | |
{ | |
public abstract decimal Postage { get; set; } | |
public abstract decimal Width { get; set; } | |
public abstract decimal Height { get; set; } | |
public abstract decimal Thickness { get; set; } | |
public string GetStatistics(int zipCode) | |
{ | |
return string.Format("Zip code is {0}, postage is {1} and height is {2}", |
This file contains 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
static void Main(string[] args) | |
{ | |
var zipCodes = new List<int>(); | |
var letter = new Letter(); | |
for (int index = 0; index < 23458333; index++) | |
{ | |
zipCodes.Add(index % 100000); | |
Console.Write(string.Format("Zip code is {0}, postage is {1} and height is {2}", | |
zipCodes[index], letter.Postage, letter.Height)); | |
} |
NewerOlder