Partial classes C# 2.0

G

Guest

Hi,

I know that we can define a class over multiple source files using the
keyword 'Partial' in C# within a project. Can we define the class over
multiple projects using the 'Patial' keyword- I know VB.Net does not allow
it, however was wondering if it's possible using C#?

Madhuri Mittal
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

A simple test will give you the answer to this. ( I can;t do it as I do not
have VS2005 in the office )

AFAIK this is not possible. you can only do this inside the same assembly.

Cheers,
 
R

Richard Blewett [DevelopMentor]

You definitely can't do it as each project compiles into a separate assembly and types are scoped to an assembly. in other words, Foo in the Bar assembly is considered, by the runtime, to be a different type to Foo is the Quuz assembly

Regards

Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk

Hi,

A simple test will give you the answer to this. ( I can;t do it as I do not
have VS2005 in the office )

AFAIK this is not possible. you can only do this inside the same assembly.

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

Madhuri Mittal said:
Hi,

I know that we can define a class over multiple source files using the
keyword 'Partial' in C# within a project. Can we define the class over
multiple projects using the 'Patial' keyword- I know VB.Net does not allow
it, however was wondering if it's possible using C#?

Madhuri Mittal



[microsoft.public.dotnet.languages.csharp]
 
G

Guest

The reason I asked this question was- VB.Net allows you not to use 'Partial'
keyword in one of it's source file definitions; however C# requires you to
use the keyword 'partial' in all of its source files- I was trying to
understand the reasoning behind this?

Madhuri

Richard Blewett said:
You definitely can't do it as each project compiles into a separate assembly and types are scoped to an assembly. in other words, Foo in the Bar assembly is considered, by the runtime, to be a different type to Foo is the Quuz assembly

Regards

Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk

Hi,

A simple test will give you the answer to this. ( I can;t do it as I do not
have VS2005 in the office )

AFAIK this is not possible. you can only do this inside the same assembly.

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

Madhuri Mittal said:
Hi,

I know that we can define a class over multiple source files using the
keyword 'Partial' in C# within a project. Can we define the class over
multiple projects using the 'Patial' keyword- I know VB.Net does not allow
it, however was wondering if it's possible using C#?

Madhuri Mittal



[microsoft.public.dotnet.languages.csharp]
 
N

Nicholas Paldino [.NET/C# MVP]

Madhuri,

You don't have to put it in all of your source files, only in your
source files where you want to split the class definition across multiple
files. If you have the implementation of the class in one file, you don't
need the partial keyword on the class.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Madhuri Mittal said:
The reason I asked this question was- VB.Net allows you not to use
'Partial'
keyword in one of it's source file definitions; however C# requires you to
use the keyword 'partial' in all of its source files- I was trying to
understand the reasoning behind this?

Madhuri

Richard Blewett said:
You definitely can't do it as each project compiles into a separate
assembly and types are scoped to an assembly. in other words, Foo in the
Bar assembly is considered, by the runtime, to be a different type to Foo
is the Quuz assembly

Regards

Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk

Hi,

A simple test will give you the answer to this. ( I can;t do it as I do
not
have VS2005 in the office )

AFAIK this is not possible. you can only do this inside the same
assembly.

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

message
Hi,

I know that we can define a class over multiple source files using the
keyword 'Partial' in C# within a project. Can we define the class over
multiple projects using the 'Patial' keyword- I know VB.Net does not allow
it, however was wondering if it's possible using C#?

Madhuri Mittal



[microsoft.public.dotnet.languages.csharp]
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

Remember that both are different languages, so they don't have to support
the same set of features, partial is one of this features, it's the compiler
the one who take all the parts and ensemble them in a final class, that;s
why you cannot split a class among different projects. doing so would move
the responsability to ensemble it to the runtime, which is not the case.

so it's even possible that c# implements the partial and not VB.net. in a
similar way that VB allows the use of "with " and not c#


cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation


Madhuri Mittal said:
The reason I asked this question was- VB.Net allows you not to use
'Partial'
keyword in one of it's source file definitions; however C# requires you to
use the keyword 'partial' in all of its source files- I was trying to
understand the reasoning behind this?

Madhuri

Richard Blewett said:
You definitely can't do it as each project compiles into a separate
assembly and types are scoped to an assembly. in other words, Foo in the
Bar assembly is considered, by the runtime, to be a different type to Foo
is the Quuz assembly

Regards

Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk

Hi,

A simple test will give you the answer to this. ( I can;t do it as I do
not
have VS2005 in the office )

AFAIK this is not possible. you can only do this inside the same
assembly.

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

message
Hi,

I know that we can define a class over multiple source files using the
keyword 'Partial' in C# within a project. Can we define the class over
multiple projects using the 'Patial' keyword- I know VB.Net does not allow
it, however was wondering if it's possible using C#?

Madhuri Mittal



[microsoft.public.dotnet.languages.csharp]
 
W

Willy Denoyette [MVP]

As far as I know, VB.NET v2.0 supports Partial classes just like C# does.
I'm I missing something?

Willy.

Ignacio Machin ( .NET/ C# MVP ) said:
Hi,

Remember that both are different languages, so they don't have to support
the same set of features, partial is one of this features, it's the
compiler the one who take all the parts and ensemble them in a final
class, that;s why you cannot split a class among different projects. doing
so would move the responsability to ensemble it to the runtime, which is
not the case.

so it's even possible that c# implements the partial and not VB.net. in a
similar way that VB allows the use of "with " and not c#


cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation


Madhuri Mittal said:
The reason I asked this question was- VB.Net allows you not to use
'Partial'
keyword in one of it's source file definitions; however C# requires you
to
use the keyword 'partial' in all of its source files- I was trying to
understand the reasoning behind this?

Madhuri

Richard Blewett said:
You definitely can't do it as each project compiles into a separate
assembly and types are scoped to an assembly. in other words, Foo in the
Bar assembly is considered, by the runtime, to be a different type to
Foo is the Quuz assembly

Regards

Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk

Hi,

A simple test will give you the answer to this. ( I can;t do it as I do
not
have VS2005 in the office )

AFAIK this is not possible. you can only do this inside the same
assembly.

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

message
Hi,

I know that we can define a class over multiple source files using
the
keyword 'Partial' in C# within a project. Can we define the class
over
multiple projects using the 'Patial' keyword- I know VB.Net does not
allow
it, however was wondering if it's possible using C#?

Madhuri Mittal



[microsoft.public.dotnet.languages.csharp]
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

I think so, but the point I was trying to make is that it does not have to,
it's a compiler feature, not a framework one and therefore dependand of the
language definition and the compiler.


cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation


Willy Denoyette said:
As far as I know, VB.NET v2.0 supports Partial classes just like C# does.
I'm I missing something?

Willy.

Ignacio Machin ( .NET/ C# MVP ) said:
Hi,

Remember that both are different languages, so they don't have to support
the same set of features, partial is one of this features, it's the
compiler the one who take all the parts and ensemble them in a final
class, that;s why you cannot split a class among different projects.
doing so would move the responsability to ensemble it to the runtime,
which is not the case.

so it's even possible that c# implements the partial and not VB.net. in a
similar way that VB allows the use of "with " and not c#


cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation


Madhuri Mittal said:
The reason I asked this question was- VB.Net allows you not to use
'Partial'
keyword in one of it's source file definitions; however C# requires you
to
use the keyword 'partial' in all of its source files- I was trying to
understand the reasoning behind this?

Madhuri

:

You definitely can't do it as each project compiles into a separate
assembly and types are scoped to an assembly. in other words, Foo in
the Bar assembly is considered, by the runtime, to be a different type
to Foo is the Quuz assembly

Regards

Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk

Hi,

A simple test will give you the answer to this. ( I can;t do it as I
do not
have VS2005 in the office )

AFAIK this is not possible. you can only do this inside the same
assembly.

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

message
Hi,

I know that we can define a class over multiple source files using
the
keyword 'Partial' in C# within a project. Can we define the class
over
multiple projects using the 'Patial' keyword- I know VB.Net does not
allow
it, however was wondering if it's possible using C#?

Madhuri Mittal



[microsoft.public.dotnet.languages.csharp]
 
G

Guest

Both C# and VB.Net support partial classes- however syntactically C# requires
you to attach the 'partial' keyword in all source files howver VB.Net does
not- I was wondering why this difference between the two?

Madhuri

Ignacio Machin ( .NET/ C# MVP ) said:
Hi,

I think so, but the point I was trying to make is that it does not have to,
it's a compiler feature, not a framework one and therefore dependand of the
language definition and the compiler.


cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation


Willy Denoyette said:
As far as I know, VB.NET v2.0 supports Partial classes just like C# does.
I'm I missing something?

Willy.

Ignacio Machin ( .NET/ C# MVP ) said:
Hi,

Remember that both are different languages, so they don't have to support
the same set of features, partial is one of this features, it's the
compiler the one who take all the parts and ensemble them in a final
class, that;s why you cannot split a class among different projects.
doing so would move the responsability to ensemble it to the runtime,
which is not the case.

so it's even possible that c# implements the partial and not VB.net. in a
similar way that VB allows the use of "with " and not c#


cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation


message The reason I asked this question was- VB.Net allows you not to use
'Partial'
keyword in one of it's source file definitions; however C# requires you
to
use the keyword 'partial' in all of its source files- I was trying to
understand the reasoning behind this?

Madhuri

:

You definitely can't do it as each project compiles into a separate
assembly and types are scoped to an assembly. in other words, Foo in
the Bar assembly is considered, by the runtime, to be a different type
to Foo is the Quuz assembly

Regards

Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk

Hi,

A simple test will give you the answer to this. ( I can;t do it as I
do not
have VS2005 in the office )

AFAIK this is not possible. you can only do this inside the same
assembly.

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

message
Hi,

I know that we can define a class over multiple source files using
the
keyword 'Partial' in C# within a project. Can we define the class
over
multiple projects using the 'Patial' keyword- I know VB.Net does not
allow
it, however was wondering if it's possible using C#?

Madhuri Mittal



[microsoft.public.dotnet.languages.csharp]
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

One more time, it does depend of the language definition and the compiler,
in the same sense that C# is case sensitive and VB is not


cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation


Madhuri Mittal said:
Both C# and VB.Net support partial classes- however syntactically C#
requires
you to attach the 'partial' keyword in all source files howver VB.Net does
not- I was wondering why this difference between the two?

Madhuri

Ignacio Machin ( .NET/ C# MVP ) said:
Hi,

I think so, but the point I was trying to make is that it does not have
to,
it's a compiler feature, not a framework one and therefore dependand of
the
language definition and the compiler.


cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation


Willy Denoyette said:
As far as I know, VB.NET v2.0 supports Partial classes just like C#
does.
I'm I missing something?

Willy.

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us>
wrote in message Hi,

Remember that both are different languages, so they don't have to
support
the same set of features, partial is one of this features, it's the
compiler the one who take all the parts and ensemble them in a final
class, that;s why you cannot split a class among different projects.
doing so would move the responsability to ensemble it to the runtime,
which is not the case.

so it's even possible that c# implements the partial and not VB.net.
in a
similar way that VB allows the use of "with " and not c#


cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation


message The reason I asked this question was- VB.Net allows you not to use
'Partial'
keyword in one of it's source file definitions; however C# requires
you
to
use the keyword 'partial' in all of its source files- I was trying to
understand the reasoning behind this?

Madhuri

:

You definitely can't do it as each project compiles into a separate
assembly and types are scoped to an assembly. in other words, Foo in
the Bar assembly is considered, by the runtime, to be a different
type
to Foo is the Quuz assembly

Regards

Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk

Hi,

A simple test will give you the answer to this. ( I can;t do it as
I
do not
have VS2005 in the office )

AFAIK this is not possible. you can only do this inside the same
assembly.

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

message
Hi,

I know that we can define a class over multiple source files
using
the
keyword 'Partial' in C# within a project. Can we define the class
over
multiple projects using the 'Patial' keyword- I know VB.Net does
not
allow
it, however was wondering if it's possible using C#?

Madhuri Mittal



[microsoft.public.dotnet.languages.csharp]
 

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

Top