Can we have more than 1 partial classes in the same file?

Answers were Sorted based on User's Feedback



Can we have more than 1 partial classes in the same file?..

Answer / ssv_sathish

YES, basically, partial classes are meant for sharing or
working on different files. so you can have 2 partial
classes in the same file or different class declared as
partial in the same file, provided PUBLIC is the access
modifier.

Is This Answer Correct ?    35 Yes 4 No

Can we have more than 1 partial classes in the same file?..

Answer / mahesh kotekar

It is possible to have partial class in same class file.

Partial Class Concept was used in dotnet to provide
practically dividing the class into two or multiple physical
files. In order to keep the complexity of class
simple.During compilation the partial classes join together
to form a single class and works as normal class
partial class First
{
public static void DoSomething1()
{
Console.WriteLine("Executing from First Part of
Class First");
}
}
partial class First
{
public static void DoSomething2()
{
Console.WriteLine("executing from second part of
class First");
}
}

Is This Answer Correct ?    9 Yes 0 No

Can we have more than 1 partial classes in the same file?..

Answer / m.karunakar

yes.more than one programmer working in the same module in
the project.example one progrmmer writing one method in main
system and ononther programmer can also add onother method
are functionlity that class by using partial class.

Is This Answer Correct ?    3 Yes 0 No

Post New Answer

More Dot Net Framework Interview Questions

Asp.net mvc application, makes use of settings at 2 places for routing to work correctly. What are these 2 places?

0 Answers  


will this code works fine? or will it gives error? Object obj=5; int i=6; i=i+obj;

9 Answers   Kanbay,


sql related question (outer join, left, right etc) array vs hashtable CRL sqldatareader vs dataset what is WPF, WCF, compare to WinForms Webservices Asp.net MVC vs WebForms?

0 Answers   Avanade,


Explain Keep method in Tempdata in ASP.Net MVC?

0 Answers  


How to set background for total website, on that another another layer, in that we keep website data,,for example see www.msn.com. On one faded background we ll have layer like other background..Do explain how its possible

2 Answers  






Can you set the unlimited length for "maxjsonlength" property in config?

0 Answers  


What is meant by domain model?

0 Answers  


Mention two instances where routing is not implemented or required?

0 Answers   Infosys,


how can you enhance the performance of entity framework?

0 Answers   Microsoft,


Explain the difference between viewbag and viewdata in mvc?

0 Answers  


What are the contents of assembly?

2 Answers  


What is the difference between the value-type variables and reference-type variables in terms of garbage collection ?

1 Answers  


Categories