Esempio n. 1
0
        static void Main(string[] args)
        {
            var myNullableRecord = new MyNullableRecord
            {
                MyNullable = 1,
            };

            var myIListRecord = new MyIListRecord
            {
                MyIList = new List <int> {
                    1, 2, 3,
                },
            };

            var listOfListsRecord = new ListOfListsRecord
            {
                MyListOfLists = new List <IList <int> >
                {
                    new List <int> {
                        1, 2, 3,
                    },
                    new List <int> {
                        4, 5, 6,
                    },
                },
            };

            var listOfNullablesRecord = new ListOfNullablesRecord
            {
                MyListOfNullables = new List <int?>
                {
                    1, null, 3, 4, null, null,
                }
            };

            var listOfNillablesRecord = new ListOfNillablesRecord
            {
                MyListOfNullables = new List <int?>
                {
                    1, null, 3, 4, null, null,
                }
            };

            var matrixRecord = new MatrixRecord
            {
                MyMatrix = new List <IList <IList <int> > >
                {
                    new List <IList <int> >
                    {
                        new List <int> {
                            1, 2,
                        },
                        new List <int> {
                            3, 4,
                        },
                    },
                    new List <IList <int> >
                    {
                        new List <int> {
                            5, 6,
                        },
                        new List <int> {
                            7, 8,
                        },
                    }
                }
            };

            var matrixOfNullablesRecord = new MatrixOfNullablesRecord
            {
                MyMatrix = new List <IList <IList <int?> > >
                {
                    new List <IList <int?> >
                    {
                        new List <int?> {
                            null, 2,
                        },
                        new List <int?> {
                            3, 4,
                        },
                    },
                    new List <IList <int?> >
                    {
                        new List <int?> {
                            5, null,
                        },
                        new List <int?> {
                            null, null,
                        },
                    }
                }
            };

            var matrixOfNillablesRecord = new MatrixOfNillablesRecord
            {
                MyMatrix = new List <IList <IList <int?> > >
                {
                    new List <IList <int?> >
                    {
                        new List <int?> {
                            null, 2,
                        },
                        new List <int?> {
                            3, 4,
                        },
                    },
                    new List <IList <int?> >
                    {
                        new List <int?> {
                            5, null,
                        },
                        new List <int?> {
                            null, null,
                        },
                    }
                }
            };

            WriteAndRead(myNullableRecord);
            WriteAndRead(myIListRecord);
            WriteAndRead(listOfListsRecord);
            WriteAndRead(listOfNullablesRecord);
            WriteAndRead(listOfNillablesRecord);
            WriteAndRead(matrixRecord);
            WriteAndRead(matrixOfNullablesRecord);
            WriteAndRead(matrixOfNillablesRecord);
        }