Exemplo n.º 1
0
        static void Main(string[] args)
        {
            var number = new Nullable <int>();

            Console.WriteLine("Has Value ?" + number.HasValue);
            Console.WriteLine("Value: " + number.GetValueOrDefault());

            //Book book = new Book();
            //var numbers = new List();
            //numbers.Add(10);
            //var books = new BookList();

            //books.Add(book);


            var numbers = new GenericList <int>();

            numbers.Add(10);
            var books = new GenericList <Book>();

            books.Add(new Book());

            var dictionary = new GenericDictionary <string, Book>();

            dictionary.Add("1234", new Book());
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Book myBook = new Book(123456789, "The Wind in the Willows", 3.99F);
            GenericList <Book> myBookList = new GenericList <Book>();

            myBookList.Add(myBook);
            //location of all generic collection types
            //System.Collections.Generic.

            GenericDictionary <string, Book> myGenDictExample = new GenericDictionary <string, Book>();

            myGenDictExample.Add("1234", myBook);

            var mynumber = new Nullable <int>(5);

            Console.WriteLine("My Number Has Valeu? : " + mynumber.HasValue);
            Console.WriteLine("MyNumber has value of ? : " + mynumber.GetValueOrDefault());
            Console.ReadLine();
        }