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
0
votes
1 answer

how to hide method overloads from intellisense and main class code file when project is part of VS2013 solution?

I have too many method overloads for each method and I'm thinking how to make MyClass more easily understandable/usable to other developers. My ideas: 1. make it partial class and new file name MyClassOldMethods.cs with all methods…
char m
  • 7,840
  • 14
  • 68
  • 117
0
votes
0 answers

Can a function call an other function in the same namespace and in same partial class but in a different file

I have a partial class defined in two different .cs (Part1.cs, Part2.cs) and I'm not able to call a function in part1.cs from part2.cs. Is it possible to do it ? Both .cs are in the same folder and can use other class in the folder…
Mr Rubix
  • 1,492
  • 14
  • 27
0
votes
1 answer

Using functionality stored in a partial class elsewhere

I am new to programming so please be kind. Visual studio automates some source code for you like when adding a database. Dbcontext has some virtual function that can be overwritten such as savechanges. I have several different classes that extend…
0
votes
1 answer

How can I use Javascript "partial classes" with TypeScript style class definition

My application has an api wrapper class originally created by typing it out in TypeScript and copying/pasting the javascript into my app. So the class def looks like this: var SiteApi = (function () { function SiteApi(initially) { //stuff …
AwokeKnowing
  • 7,728
  • 9
  • 36
  • 47
0
votes
1 answer

Assign event from partial class

I have made a winform application in c#. Now I added a class named Main_Form_1. In Main_Form, there are some click events that I copied in Main_Form_1. // Main_Form.cs public partial class Main_Form : Form { ... // code here ... } //…
DhavalR
  • 1,409
  • 3
  • 29
  • 57
0
votes
1 answer

How can I alias partial classes generated by Entity Framework Code First From Database?

I'm learning EF code first from database using this MSDN tutorial. The generated model partial class names always match the database object names. Instead I'd like to assign an alias to the generated database model objects. How should I go about…
DeveloperDan
  • 4,626
  • 9
  • 40
  • 65
0
votes
1 answer

How does EntityState, HasChanges, HasPropertyChanges work on Partial Classes?

I have a class coming from EntityFramework which I have extended with a few properties in a partial class. I expose and edit the values of these properties in my interface and everything works fine. But, I want to detect the change of value in the…
0
votes
2 answers

Redefine method return type in derived class without generics

TL;DR: Is there some way to add an abstract method to a base class that allows derived classes to override the method's return type, without the use of generics, and without the use of the new keyword? I'm working on developing some custom…
cmptrgeekken
  • 8,052
  • 3
  • 29
  • 35
0
votes
1 answer

Create separate class files from one file that contains multiple public partial classes

I have a process that converts an xml file/object into a set of public partial classes. It uses the same code base as xsd.exe (I think) to create schemas from the xml and then create classes from the schemas. However, I am wanting to split each…
Popo
  • 2,402
  • 5
  • 33
  • 55
0
votes
1 answer

Two constructors with same name different parameters entity framework

I have a partial class Table1 which is generated by EF and I have created another partial class Table1 in the same namespace with the same name with some custom properties. EF has created a parameterless constructor and I need to have one more…
user3557236
  • 289
  • 1
  • 4
  • 14
0
votes
3 answers

How to get a method on a main form to get executed on the main form whenever i do some action on a secondary form?

I'm trying to update my data on a main form whenever I change some option in a secondary form. Possible solution: Make the method public on Form1 (the main form) like this: public void updatedata() { //data update } And then call it on the…
ng80092b
  • 621
  • 1
  • 9
  • 24
0
votes
1 answer

Super-interface in a partial class in WCF

I am creating a WCF service with multiple interfaces say "IService" as my main interface (Service Contract) and other interfaces added based on my modules. like - "IStudent", "IClass", "ITeacher" etc. So what i am planning is like this…
Abhijith Nayak
  • 448
  • 7
  • 21
0
votes
1 answer

Execute a Form2 method on Form2, whenever Form1 textBox value is changed

I want a "baby" form from my "main form" to update itself, whenever my main form changes something, let's make this clear using examples: My "baby" form: public partial class Ventoemparedes : Form { private Form1 Opener { get; set; } …
ng80092b
  • 621
  • 1
  • 9
  • 24
0
votes
2 answers

Appending a method to a class

Hello I have a RobotFramework library for requests /usr/local/lib/python2.7/dist-packages/RequestsLibrary/RequestsKeywords.py that is missing some code to expose the Digest authentication method in the Python.Requests library. What I want to do is…
RobM
  • 747
  • 5
  • 12
0
votes
1 answer

How can I derive a class nested inside a partial class?

If I have an abstract class nested inside a partial container class nested inside another class, how can I derive classes from the base class? I would think the following would work, but it says BaseClass isn't accessible due to protection level. I…
kkirkfield
  • 85
  • 8