-
-
Save dcomartin/eb65dc6acc741cf1a29ca16f9609971d to your computer and use it in GitHub Desktop.
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 Product(int id, OfferingType type) { } | |
public class DownloadableProduct(int id, OfferingType type) : Product(id, type) | |
{ | |
public Option<string> GetDefaultDownloadFileName() | |
{ | |
return Option.Some("Some Value"); | |
} | |
public Option<string> GetDownloadUrl() | |
{ | |
return Option.Some("Some Value"); | |
} | |
} | |
public sealed class ProductHandler() | |
{ | |
public void DoStuff(DownloadableProduct product) | |
{ | |
product.GetDefaultDownloadFileName().MatchSome( | |
filename => | |
{ | |
// Do something with the filename. | |
}); | |
product.GetDownloadUrl().MatchSome( | |
url => | |
{ | |
// Do something with the url | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment