Giter Site home page Giter Site logo

bubdm / dynamictypes-1 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from okmer/dynamictypes

0.0 0.0 0.0 12 KB

DynamicBag is a toy project that uses a Dictionary<string, dynamic> to create a dynamic storage class.

License: MIT License

C# 100.00%

dynamictypes-1's Introduction

DynamicTypes

DynamicBag is a toy project that uses a Dictionary<string, dynamic> to create a dynamic storage class.

I'm just playing with Dynamic and Polymorphism...

DynamicBag shoppingBag = new DynamicBag();
DynamicBag spareBag = new DynamicBag();

//Add some stuff to our bags (and add the spareBag into the shoppingBag)
shoppingBag.Add("spareBag", spareBag);
shoppingBag.Add("shoppingList", new string[] { "eggs", "milk", "cheese" });

spareBag.Add("carCoin", "50ct");
spareBag.Add("carValue", 50);

//Save shoppingBag (with the spareBag inside) to file
shoppingBag.ToBinaryFile("shoppingBag.bin");

//Load shoppingBag (with the spareBag inside) from file
DynamicBag shoppingBag2 = DynamicBag.FromBinaryFile("shoppingBag.bin");

//Get some stuff from our bags (and get the spareBag out of the shoppingBag)
DynamicBag spareBag2 = shoppingBag2["spareBag"];
string carCoin2 = spareBag2["carCoin"];
int carValue2 = spareBag2["carValue"];

dynamictypes-1's People

Contributors

okmer avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.