Questions tagged [partial-classes]

With this keyword classes can be split into multiple definitions, but it compiles into one class.

With this keyword, classes can be split into multiple (mostly two) definitions, but the code compiles into one run-time class.

References

441 questions
14
votes
20 answers

Partial Classes in C#

Are there are good uses of Partial Classes outside the webforms/winforms generated code scenarios? Or is this feature basically to support that?
Brian G
  • 53,704
  • 58
  • 125
  • 140
13
votes
1 answer

Partial class debugging

I have created a partial class for my xsd auto generated class. The problem is in debugging this partial class. Breakpoint are not recognized or the compiler doesn't break at the breakpoints set in the partial class. // Autogenerated class by…
Bart
  • 273
  • 3
  • 8
13
votes
1 answer

List of all domain classes in Grails

how can I get a list of alle domain classes I use in my project? Something like GORM.domains.list().
Jan
  • 1,445
  • 1
  • 16
  • 20
13
votes
5 answers

Override a virtual method in a partial class

I am currently working with the nopCommerce source code and trying my best to avoid editing the source at all, but instead using partial classes and plugins that are separate from the source code, should we ever need to upgrade versions. I want to…
DevDave
  • 6,700
  • 12
  • 65
  • 99
13
votes
6 answers

C# - what are the benefits of "partial" classes?

I'm asking this because I find it quite a dangerous feature to distribute the class definition so that you can't really be sure if you know all about it. Even if I find three partial definitions, how do I know that there's not a fourth…
sharkin
  • 12,162
  • 24
  • 86
  • 122
13
votes
4 answers

C# partial class

How do I program a partial class in C# in multiple files and in different namespaces?
Partial
  • 9,529
  • 12
  • 42
  • 57
12
votes
6 answers

C++ partial method specialization

Is there a partial specialization for template class method? template class C { void foo(); } it doesn't work to specialize it like this: template void C::foo() {}; Any help?
faya
  • 5,535
  • 11
  • 37
  • 49
11
votes
8 answers

Partial class with same name method

I have a partial class like this public partial class ABC { public string GetName() { //some code here } public string GetAge() { //some code here } } public partial class ABC { public string GetSex() { //some…
Pankaj
  • 4,419
  • 16
  • 50
  • 72
10
votes
4 answers

Is it possible to declare a partial class in two projects

Consider we create a partial class in Project1 and we have a Project2 that has reference to Project1 .How is it possible to declare some other method of partial class in Project2 ? thanks
Arian
  • 12,793
  • 66
  • 176
  • 300
10
votes
8 answers

Implementing interfaces in partial classes

Consider a class which implements a lot of interfaces, would it make sense to implement each interface in a separate file using partial class definitions? Would this be an abuse of the language feature or is it an idiom I'm unaware of?
Motti
  • 110,860
  • 49
  • 189
  • 262
10
votes
2 answers

What does the partial mean?

public partial class Form1 : Form What does the partial in this declaration mean? I understand we have a class Form1 that inherits from Form. But what does the partial mean?
RoR
  • 15,934
  • 22
  • 71
  • 92
10
votes
7 answers

A shortcut to jump between partial classes

Is there a shortcut to jump between partial classes for the same class in the VS2012 editor? I know I can use search but I was hoping for a shortcut.
user915331
10
votes
5 answers

EF 5 Model First Partial Class Custom Constructor How To?

EF has generated for me some partial classes, each with a constructor, but it says not to touch them (example below), now if I make my own secondary partial class and I want to have a constructor that automatically sets some of the fields how do I…
sprocket12
  • 5,368
  • 18
  • 64
  • 133
10
votes
3 answers

Using partial classes

Is there any overhead using partial classes in case of memory, performance etc? If we create a partial class can we identify whether the class was partial or not using reflector??
rahul
  • 184,426
  • 49
  • 232
  • 263
9
votes
2 answers

Show all files contain same partial class

I have a partial class public partial class myClass defines in different files, e.g. myClass1.cs, myClass2.cs, etc. Is there a way for resharper or Visual studio built-in functionalities to find all the files belong to the same partial class?
william007
  • 17,375
  • 25
  • 118
  • 194
1 2
3
29 30