Exemplo n.º 1
0
        private static void AddListOfPeople()
        {
            var people = new List <Person>
            {
                new Person {
                    Name = "John", Age = 10, Pets = new List <string> {
                        "dog", "cat"
                    }
                },
                new Person {
                    Name = "Jane", Age = 20, Pets = new List <string> {
                        "bird", "snake"
                    }
                },
                new Person {
                    Name = "Tom", Age = 30, Pets = new List <string> {
                        "fish", "hamster"
                    }
                }
            };


            // 'Inject' the object into PowerShell
            PowerShellExtensions.AddVariable("People", people);
        }
Exemplo n.º 2
0
        private static void AddPersonVariable()
        {
            var p = new Person
            {
                Name = "John",
                Age  = 10,
                Pets = new List <string> {
                    "dog", "cat"
                }
            };

            // 'Inject' the object into PowerShell
            PowerShellExtensions
            .AddVariable("Person", p);
        }