Created
July 25, 2014 17:05
-
-
Save togakangaroo/ae6fb297e5dd78f15a07 to your computer and use it in GitHub Desktop.
Demonstration of things you can do with inner classes
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
public class Presentation | |
{ | |
public class PackageResult | |
{ | |
public string Name; | |
public Stream Stream; | |
} | |
//PackageResult as an inner clas can be a good idea since its really just a Tuple and has no reusability value | |
public PackageResult Package() | |
{ | |
//... | |
} | |
} |
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
public class PresentationTemplate | |
{ | |
public string Id { get; private set; } | |
public IEnumerable<PresentationTemplate.Slide> Slides { get; private set; } | |
private readonly FileInfo templateFile; | |
protected virtual PresentationTemplate.Slide CreateSlide(CM.Slide s, PresentationExporter exporter, CM.Presentation preso) | |
{ | |
return new PresentationTemplate.Slide( | |
this, | |
Int32.Parse(s.Id), | |
() => exporter.Export(preso, s) | |
); | |
} | |
public class Slide | |
{ | |
public string Id { get; private set; } | |
public void DoStuff() | |
{ | |
//Note that this also has access to the internals of its parent | |
doStuffWith(this.Template.templateFile) | |
} | |
public Slide(PresentationTemplate vpt, int originalSlideId, Func<XDocument> getSvg) | |
{ | |
this.Template = vpt; | |
this.OriginalSlideId = originalSlideId; | |
this.Id = SlideDelimitorUtils.AssembleSlideId(vpt.Id, originalSlideId); | |
this.getSvg = getSvg; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment