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
| try | |
| { | |
| Console.WriteLine("Enter entity type:"); | |
| var entytyType = (EntityType)Enum.Parse(typeof(EntityType), Console.ReadLine(), true); | |
| Console.WriteLine("Enter new value:"); | |
| var modificationValue = Convert.ToInt32(Console.ReadLine()); | |
| var entityFactory = new EntityFactory(); | |
| var entity = entityFactory.GetEntityBasedOnType(entytyType); |
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
| type Shape = | |
| | Rectangle of width : float * length : float | |
| | Circle of radius : float |
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
| let getShapeHeight shape = | |
| match shape with | |
| | Rectangle(width = h) -> h | |
| | Circle(radius = r) -> 2. * r |
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
| var shapes = new Dictionary<string, object> | |
| { | |
| { "FirstShape", new Rectangle(1, 1) }, | |
| { "SecondShape", new Circle(6) } | |
| }; | |
| foreach(var shape in shapes) | |
| { | |
| if (shape.Value is Rectangle) | |
| { |
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
| foreach (var shape in shapes) | |
| { | |
| switch(shape.Value) | |
| { | |
| case Rectangle r: | |
| Console.WriteLine(r.Height); | |
| break; | |
| case Circle c: | |
| Console.WriteLine(2 * c.Radius); | |
| break; |
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
| foreach (var shape in shapes) | |
| { | |
| switch(shape.Value) | |
| { | |
| case Rectangle r: | |
| Console.WriteLine(r.Height); | |
| break; | |
| case Circle c when c.Radius > 10: | |
| Console.WriteLine(2 * c.Radius); | |
| break; |
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
| { | |
| "_id" : ObjectId("58e28d41b1ad7d0c5cd27549"), | |
| "name" : "Nikola Zivkovic", | |
| "blog" : "rubikscode.net", | |
| "numberOfArticles" : 10, | |
| "Adress" : [ | |
| "street" : "some street", | |
| "city" : "Novi Sad", | |
| "country" : "Serbia" | |
| ], |
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
| { | |
| "_id" : ObjectId("58e28da0b1ad7d0c5cd2754a"), | |
| "name" : "Vladimir Pecanac", | |
| "blog" : "code-maze.com", | |
| "Adress" : [ | |
| "street" : "some street", | |
| "city" : "Novi Sad", | |
| "country" : "Serbia" | |
| ], | |
| "company" : "Vega IT Sourcing", |
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
| { | |
| _id : "rs0", | |
| members: [ | |
| {_id : 0, host : "localhost:27017"} | |
| ] | |
| } |
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
| { | |
| _id : "rs0", | |
| members: [ | |
| { _id : 0, host : "localhost:27017" }, | |
| { _id : 0, host : "localhost:27018" }, | |
| { _id : 0, host : "localhost:27019" } | |
| ] | |
| } |