Results 11 to 20 of 31
-
24th Jun 2010, 08:01 PM #11Respected Developer
You can use 'this' but not to access static members. And only the programs entry point is required to be static. The rest is up to you.
PS: msdn.com
-
24th Jun 2010, 08:17 PM #12ლ(ಠ益ಠლ)Website's:
extremecoderz.comdont ask me about all that lol. Ask me how, ill show you, ask me all those questions, ill give you "the face" - a.k.a. -
-
24th Jun 2010, 08:17 PM #13OPMemberWebsite's:
litewarez.net litewarez.com triniwarez.comya static = method thats not able to be called from an "instance".
PHP Code:using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Litewarez
{
class Program
{
static void Main(string[] args)
{
object Output = new Output(); /*Just learning multiple objects*/
Output.Send("This is a test"); /*This i expect to work be C# sharp goes nooo noo no*/
}
}
class Output
{
public void Send(string Text)
{
Console.WriteLine(Text);
}
}
}
i
you for helping
'object' does not contain a definition for 'Send' and no extension method 'Send' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)Join Litewarez.net today and become apart of the community.
Unique | Clean | Advanced (All with you in mind)
Downloads | Webmasters
Notifications,Forum,Chat,Community all at Litewarez Webmasters
-
24th Jun 2010, 08:27 PM #14Respected Developer
no, static has nothing to do with the class. What you describe is a 'sealed class'.
Also:
Code:using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Litewarez { class Program { static void Main(string[] args) { Output op = new Output(); /*Just learning multiple objects*/ op.Send("This is a test"); /*This i expect to work be C# sharp goes nooo noo no*/ } } class Output { public void Send(string Text) { Console.WriteLine(Text); } } }
-
24th Jun 2010, 08:29 PM #15OPMemberWebsite's:
litewarez.net litewarez.com triniwarez.comSee now Output op = new Output(); to me is pointless, it should automatically know that what object it is from the call.
Would you do
OtherOutput oop = new Output(); ??
yea i have a lot of books but i cant readxx
Join Litewarez.net today and become apart of the community.
Unique | Clean | Advanced (All with you in mind)
Downloads | Webmasters
Notifications,Forum,Chat,Community all at Litewarez Webmasters
-
24th Jun 2010, 08:31 PM #16Respected Developer
[type_name] [var_name] = new [type_name];
Don't try to apply PHP rules to C#. PHP is a dynamic language, C# a strongly typed one (meaning there is type safety). Again, ebook.
-
24th Jun 2010, 08:35 PM #17OPMemberWebsite's:
litewarez.net litewarez.com triniwarez.comNo Hyperz, i wasn't trying to think like PHP on this bit, im just saying it seems Pointless to have.
[type_name] [var_name] = new [type_name];
because C# should know the type_name from the new [type_name] i don't get why we have to wrtie the object name 2 times as your only assigning a reference to a variable :/
Having:
[var_name] = new [type_name];
yype_name should already know its an instance of Output.
Theres more than likly a perfect excuse as Obv the main C# guys are way advanced i just don't know the reason why.. then again EBOOK loool
Thanks for the info tho!
Also my first bit of C#
PHP Code:using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Litewarez
{
class Program
{
static void Main(string[] args)
{
Output Output = new Output();
//Ask the Question
Output.Send("Please Enter your name");
//Get the name
var name = Output.ReadInput();
//Clear the screan from "login xD"
Output.Clear();
//Send a welcome message
Output.Send("Welcome: " + name);
//Chill out!
Console.Read();
}
}
class Output
{
public void Send(string Text)
{
Console.WriteLine(Text + "\n");
}
public void Clear()
{
Console.Clear();
}
public string ReadInput()
{
return Console.ReadLine();
}
}
}
Join Litewarez.net today and become apart of the community.
Unique | Clean | Advanced (All with you in mind)
Downloads | Webmasters
Notifications,Forum,Chat,Community all at Litewarez Webmasters
-
24th Jun 2010, 08:43 PM #18Respected Developer
Again, C# is NOT a dynamic language. http://en.wikipedia.org/wiki/Type_safety
These are all the very basics. That's why I keep saying read an ebook. If you're not willing to do that you're never gonna be good at it. Asking us for help here and reading a tut here and there will not get you far. I know I might sound a bit harsh here but that's how it is. What you're asking here now is something that gets explained in the first pages of any good eBook.
And again, when dealing with C#, forget you ever learned PHP because you'll get confused trying to apply scripting logic to programming logic.
-
24th Jun 2010, 08:45 PM #19OPMemberWebsite's:
litewarez.net litewarez.com triniwarez.comOk i will, Try.
And yea i will read Professional C# 2008 (http://www.amazon.co.uk/dp/047019137...ackoverfl08-20)
ill print it at Work loooooooooolJoin Litewarez.net today and become apart of the community.
Unique | Clean | Advanced (All with you in mind)
Downloads | Webmasters
Notifications,Forum,Chat,Community all at Litewarez Webmasters
-
25th Jun 2010, 07:35 AM #20The Wise OneWebsite's:
twilight.ws ddlrank.comI was just about to post the same thing. You should really start out with the basics before coding anything serious lol
EDIT: If you can't find a good eBook PM me Ill try and get the one I had in college.I can always be contacted by sending a tweet @twilightws
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
Hyperz.. I need your help.
By R4Z0R3 in forum Technical Help Desk SupportReplies: 0Last Post: 4th Jun 2010, 05:25 AM -
Hyperz.. I need your help.
By R4Z0R3 in forum Technical Help Desk SupportReplies: 8Last Post: 3rd Jun 2010, 02:52 AM
themaCreator - create posts from...
Version 3.45 released. Open older version (or...