Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Related to Question at:
- //http://groups.google.com/group/dotnetdevelopment/browse_thread/thread/a5c0e565de89bff0/
- //Original Date of pasting: Jul 14th, 2010
- //Original URL: http://pastebin.com/KF61pNCe
- //Person.cs
- //*****************
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace testglobalclass2
- {
- public class Person
- {
- string PersonName;
- public Person(string PersonName)
- {
- this.PersonName = PersonName;
- }
- public string Personname
- {
- get { return Personname; }
- }
- }
- }
- //Group.cs
- //*****************
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace testglobalclass2
- {
- public static class Group
- {
- static Person person;
- public static Person GlobalPerson
- {
- get { return person; }
- set { person = value; }
- }
- }
- }
- //Program.cs
- ///*****************
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace testglobalclass2
- {
- class Program
- {
- static void Main(string[] args)
- {
- Person gbPerson = new Person("Mister X");
- Group.GlobalPerson = gbPerson;
- string test = Group.GlobalPerson.Personname;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment