Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Best way to re-factor
Message
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01565967
Message ID:
01566006
Views:
51
>>>It;s just a class declaration within a class.
>>>
>>>	class TheClass
>>>	{
>>>		public void Work()
>>>		{
>>>
>>>			PrivateClass hello = new PrivateClass();
>>>
>>>			hello.DoWork(); // with parameters needed
>>>			Console.WriteLine("{0} {1}", hello.StartTime, hello.EndTime);
>>>			Console.ReadLine();
>>>
>>>		}
>>>		private class PrivateClass
>>>		{
>>>			public DateTime StartTime { get; private set; }
>>>			public DateTime EndTime { get; private set; }
>>>
>>>			public void DoWork()
>>>			{
>>>				StartTime = DateTime.Now;
>>>				EndTime = DateTime.Now;
>>>			}
>>>
>>>		}
>>>
>>>	}
>>>	
>>>
>>
>>I see, thanks a lot - this may be very useful for me.
>
>I don't think it's much of a difference. It's just a different means of accessibility to a class. What's in the class is still the same. You instantiate it the same way and use it the same way. All that changes is where the PM finds it.

I think the difference is (as I understood this code), that this class can only be used inside the main class and it's not accessible from outside.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform