Need Help Using Seperate CS Files For 1 Projecttitle says it
Page 1 of 1
7 Replies - 2123 Views - Last Post: 05 January 2009 - 11:11 PM
#1
Need Help Using Seperate CS Files For 1 Project
Posted 05 January 2009 - 10:30 AM
~Thanks in advance,
Seth.
Replies To: Need Help Using Seperate CS Files For 1 Project
#2
Re: Need Help Using Seperate CS Files For 1 Project
Posted 05 January 2009 - 03:11 PM
If you are just using one class then you can use 'partial class' to just move code to another file but still keep it within your curent class. This would maintain access to variables within your current class.
If you are already using more than one class just put each class in a seperate file under the same namespace.
Hope this helps,
Kitt
#3
Re: Need Help Using Seperate CS Files For 1 Project
Posted 05 January 2009 - 03:12 PM
className.Member
This post has been edited by Core: 05 January 2009 - 03:15 PM
#4
Re: Need Help Using Seperate CS Files For 1 Project
Posted 05 January 2009 - 07:33 PM
djkitt, on 5 Jan, 2009 - 02:11 PM, said:
If you are just using one class then you can use 'partial class' to just move code to another file but still keep it within your curent class. This would maintain access to variables within your current class.
If you are already using more than one class just put each class in a seperate file under the same namespace.
Hope this helps,
Kitt
I do need to use the same class, that would be very helpful. Do you know how to use 'partial classes' because I've never heard of it.
#5
Re: Need Help Using Seperate CS Files For 1 Project
Posted 05 January 2009 - 08:07 PM
s3thst4, on 5 Jan, 2009 - 06:33 PM, said:
djkitt, on 5 Jan, 2009 - 02:11 PM, said:
If you are just using one class then you can use 'partial class' to just move code to another file but still keep it within your curent class. This would maintain access to variables within your current class.
If you are already using more than one class just put each class in a seperate file under the same namespace.
Hope this helps,
Kitt
I do need to use the same class, that would be very helpful. Do you know how to use 'partial classes' because I've never heard of it.
Did you google it?
Understanding and Using .NET Partial Classes
Scroll down to this line; "The syntax of partial classes in VB.NET and C# differs slightly. The following shows the implementation of partial classes in C#:"
Hey s3thst4, btw I happen to be working on something almost exactly like you are it sounds. Well I am a few steps behind in the design phase still but I would love to hear how you are doing things. I am trying to perfect a movement system right now and I would especially like to hear how you did that.
This post has been edited by badjava: 05 January 2009 - 08:11 PM
#6
Re: Need Help Using Seperate CS Files For 1 Project
Posted 05 January 2009 - 09:18 PM
badjava, on 5 Jan, 2009 - 07:07 PM, said:
s3thst4, on 5 Jan, 2009 - 06:33 PM, said:
djkitt, on 5 Jan, 2009 - 02:11 PM, said:
If you are just using one class then you can use 'partial class' to just move code to another file but still keep it within your curent class. This would maintain access to variables within your current class.
If you are already using more than one class just put each class in a seperate file under the same namespace.
Hope this helps,
Kitt
I do need to use the same class, that would be very helpful. Do you know how to use 'partial classes' because I've never heard of it.
Did you google it?
Understanding and Using .NET Partial Classes
Scroll down to this line; "The syntax of partial classes in VB.NET and C# differs slightly. The following shows the implementation of partial classes in C#:"
Hey s3thst4, btw I happen to be working on something almost exactly like you are it sounds. Well I am a few steps behind in the design phase still but I would love to hear how you are doing things. I am trying to perfect a movement system right now and I would especially like to hear how you did that.
Thanks a lot for the link. It should help me a lot.
Mine is text-based, no graphics at all. I apologize for misleading you.
#7
Re: Need Help Using Seperate CS Files For 1 Project
Posted 05 January 2009 - 10:11 PM
s3thst4, on 5 Jan, 2009 - 08:18 PM, said:
Mine is text-based, no graphics at all. I apologize for misleading you.
No misleading at all. If it is text based you still might need a method of going from 'place to place' yes? Or is your version more of a story board where people get to choose things to do and see the results but not necessarily go from room x to room y and back to room x if they choose to?
And ty for the ty
This post has been edited by badjava: 05 January 2009 - 10:24 PM
#8
Re: Need Help Using Seperate CS Files For 1 Project
Posted 05 January 2009 - 11:11 PM
badjava, on 5 Jan, 2009 - 09:11 PM, said:
s3thst4, on 5 Jan, 2009 - 08:18 PM, said:
Mine is text-based, no graphics at all. I apologize for misleading you.
No misleading at all. If it is text based you still might need a method of going from 'place to place' yes? Or is your version more of a story board where people get to choose things to do and see the results but not necessarily go from room x to room y and back to room x if they choose to?
And ty for the ty
Ah, I understand where you're getting. What I do is, here is some example code.
do
{
Console.WriteLine("Would you like to \n1) Go to town \n2) Do a quest \n3) Go to the shop");
whattodo = Console.ReadLine();
} while (whattodo == "" || whattdo != "1" && whattdo != "2" && whattodo != "3");
if (whattdo == "1")
{
Town(); // A custom method I created.
}
if (whattdo == "2")
{
Quest(); // A custom method I created.
}
if (whattodo == "3")
{
Store(); // A custom method I created.
}
And in the methods I create, I give information what to do in 'Town' and the Town reverts back to the method that you just saw with the same with this reverted to Town.
Hope I was helpful.
|
|

New Topic/Question
Reply



MultiQuote






|