compiling..

  • Thread starter Thread starter maya
  • Start date Start date
M

maya

hi,

I'm following example 'Intro7.aspx' here,
http://www.csharpfriends.com/quickstart/aspplus/doc/webformsintro.aspx#customctrls

it says on top of Acme.cs "namespace Acme" I assume this means Acme.cs
has to be in a dir called 'Acme'? (am assuming namespace is equiv to
Java's packages; is this right?)

at any rate I can't compile Acme.cs.. get errors (I'm compiling in
command line, thus: csc.exe Acme.cs.. get lots of errors, dealing mostly
with obsolete stuff..)

I'm also confused about two other things:

1) I don't see this, CodeFile="Acme.cs" anywhere in aspx.. (going by
what I see where I work, just started working here & trying to learn
..NET..)

2) Acme.cs starts with

public class Calendar : Control, IPostBackEventHandler,
IPostBackDataHandler

but Control is a class, not an interface (can u implement classes?)

thank you.
 
maya said:

I think we could answer these questions, but there would be more to follow ...
a lot more. Honestly, I think what you really need is a good book to sit down
with and learn.

Since you are working with an ASP application, consider:

http://www.bookpool.com/sm/0470042583

Or, if you really just need C# (my recommendation to start), how about:

http://www.bookpool.com/sm/0735621292
or
http://www.bookpool.com/sm/0764578472
 
Thomas said:
I think we could answer these questions, but there would be more to follow ...
a lot more. Honestly, I think what you really need is a good book to sit down
with and learn.

Since you are working with an ASP application, consider:

http://www.bookpool.com/sm/0470042583

Or, if you really just need C# (my recommendation to start), how about:

http://www.bookpool.com/sm/0735621292
or
http://www.bookpool.com/sm/0764578472

ok, thanks, but this tutorial should include instructions so you can run
the example.. he doesn't even say the .cs needs to be compiled.. I
HAVE been looking at books, of course; have also seen this one,
http://www.amazon.com/gp/product/15...ef=sr_1_2/103-5546102-3474261?ie=UTF8&s=books
anybody have any opinion on this one?

I'm a front-end developer here, but thought I'd try to understand some
back-end stuff to help me along.. I HAVE done back-end, mostly on Java,
but .NET is so different from anything I have ever seen, even the HTML
code is different with .NET.. so was just trying to learn the basics,
mainly re controls, etc..

thanks again..
 
maya said:
hi,

I'm following example 'Intro7.aspx' here,
http://www.csharpfriends.com/quickstart/aspplus/doc/webformsintro.aspx#customctrls

it says on top of Acme.cs "namespace Acme" I assume this means Acme.cs
has to be in a dir called 'Acme'? (am assuming namespace is equiv to
Java's packages; is this right?)

at any rate I can't compile Acme.cs.. get errors (I'm compiling in
command line, thus: csc.exe Acme.cs.. get lots of errors, dealing mostly
with obsolete stuff..)

I'm also confused about two other things:

1) I don't see this, CodeFile="Acme.cs" anywhere in aspx.. (going by
what I see where I work, just started working here & trying to learn
.NET..)

2) Acme.cs starts with

public class Calendar : Control, IPostBackEventHandler,
IPostBackDataHandler

but Control is a class, not an interface (can u implement classes?)

thank you.

Hi Maya,
it says on top of Acme.cs "namespace Acme" I assume this means Acme.cs
has to be in a dir called 'Acme'? (am assuming namespace is equiv to
Java's packages; is this right?)

Not exactly. Unlike Java, class and namespace definitions within code-files
are not dependant on where they are in the file system. Basically, you can
put your code-file anywhere, and define any number of namespaces and public
classes in your code-file.
but Control is a class, not an interface (can u implement classes?)

You don't implement a class, you inherit a class. The syntax is valid, it's
the same as using the Java 'extends' clause:

public class Calendar extends Control implements IPostBackEventHandler {
...
}
 
...

Thomas gave you excellent suggestion to where to begin, but I will anyway
answer some of the specific questions you had as well.
it says on top of Acme.cs "namespace Acme" I assume this means
Acme.cs has to be in a dir called 'Acme'? (am assuming namespace
is equiv to Java's packages; is this right?)

Not quite. Java's packages are used for both logical and physical
structuring, but in .NET it's "only" the logical structure.

You can have the source code anywhere you like, and the MSIL (roughly
corresponding to Java's bytecode) is put into an assembly.
public class Calendar : Control, IPostBackEventHandler,
IPostBackDataHandler

but Control is a class, not an interface (can u implement classes?)

Here it's actually similar to Java, that a class can extend only one
superclass, but implement many interfaces.

However, the syntax for extending and implementing is the same in C#, the
colon (:), which means that if it would have been Java, it would have looked
like:

public class Calendar
extends Control
implements IPostBackEventHandler, IPostBackDataHandler


/// Bjorn A
 
Tom said:
Hi Maya,


Not exactly. Unlike Java, class and namespace definitions within code-files
are not dependant on where they are in the file system. Basically, you can
put your code-file anywhere, and define any number of namespaces and public
classes in your code-file.


You don't implement a class, you inherit a class. The syntax is valid, it's
the same as using the Java 'extends' clause:

public class Calendar extends Control implements IPostBackEventHandler {
...
}

thank you very much, Tom.. so the colon means: extend if class,
implement if interface.. interesting.. (just realized, btw, on this
example, since this is aspx and not a stand-alone .cs class, that I
probably need to do this in VS and run 'build' command, since .cs needs
to compile into a .dll and not .exe (when I compile with csc.exe in
command-line it compiles classes into .exe..)

again thanks...
 
maya said:
probably need to do this in VS and run 'build' command, since .cs needs
to compile into a .dll and not .exe (when I compile with csc.exe in
command-line it compiles classes into .exe..)

csc has a /target switch for choosing whether to compile an exe or dll.
For a .dll it is /target:library
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top