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
2 answers

How to use a method that is in a partial class from another partial class

I am working in an Excel file with Visual Studio and programming in C#. I added a listbox control to the sheet Seismic2D. I want to fill this listbox with information that is in the sheet FileList. The button that I am trying to program is in…
Dorian Oria
  • 119
  • 10
0
votes
1 answer

LINQ Changes Not Recognized When Using Generics

I am currently trying to create a Class which employs generics in order to reduce the amount of work needed for future development. As I add Tables to the LINQ To SQL Designer, certain basic Methods are used in each one. Rather than reproduce them…
0
votes
0 answers

How to change function implementation for automatically generated partial class?

Visual Studio automatically generated a partial class in my project, containing a function whose implementation I want to change. Is this doable without losing the changes I made whenever the class is automatically generated again? Example: Partial…
Kai Hartmann
  • 3,106
  • 1
  • 31
  • 45
0
votes
1 answer

Partial Entity class with shared.vb extension not associated with 'other' partial class in client using RIA Services

I have extended an Entity Framework 4 entity class with a calculated property in a partial class. This member is not available on the client to which the entities are exposed via WCF RIA Services. The solution to this problem when using C# appears…
Scott Munro
  • 13,369
  • 3
  • 74
  • 80
0
votes
1 answer

Multiple Inheritance for partial class

I'm looking at some code I've inherited. I've added the PrintSpecialInfo() method and get the error show below when trying to call it. I'm confused with the class SpecialPermit. Is it a case of multiple inheritance, both Permit and…
Al Lelopath
  • 6,448
  • 13
  • 82
  • 139
0
votes
0 answers

How to add a method to a Binding Library in Xamarin.Android?

I've been fixing a library in Xamarin.Android: https://stackoverflow.com/a/56778629/2889347 However, I found that an important method is missing in my code: /** * Sets a custom adapter for suggestions list view. * * @param suggestionAdapter…
0
votes
0 answers

Changing the material of the Hololens SpatialMapping prefab from Holotoolkit through script?

I am creating a project for the Microsoft Hololens through Unity3D, version 2017.4.16f1. I have the HoloToolkit added to my project, and am using its default SpatialMapping prefab. I am also using the HololensShaderPack found on the asset store and…
A.Crane
  • 435
  • 1
  • 3
  • 12
0
votes
2 answers

Where to put common interface methods when dealing with partial classes, inheritance, and Visual Studio Generated Code

Consider this situation: We have two classes generated by Visual Studio, for example Typed Dataset Rows. These classes derive from a common base class which we cannot change. We cannot change the class these child classes derive from, but they…
Chris Mullins
  • 6,677
  • 2
  • 31
  • 40
0
votes
0 answers

Partial Methods - Multiple implementing declarations alternate solution?

I am currently trying to understand the purpose of partial methods as, the way in which i was hoping to use them was like an event. Example.cs public partial class Example { partial void LoadData(); public void Example() { …
A.Mills
  • 357
  • 3
  • 16
0
votes
2 answers

Import/Call class vb.net from external .vb file

I have a pretty big VB.net code and I am trying to split it into different files. I want to create an external file containing different functions. I have read about partial class files but it is not working for me. Is there any option to…
Jordi
  • 11
  • 1
  • 1
0
votes
8 answers

Using a method from a partial class

So I have this method: public IList GetProjectsForSponsor(int sponsorId) { IList result = new List(); IWspWB_IndicationGetProjectsForEntityResultSet…
slandau
  • 23,528
  • 42
  • 122
  • 184
0
votes
1 answer

external changing implementation of class

Is there a way to change implementation of given class from outside? For example, I have the following implementation: public partial class Test { public Interface1 Field = new Class1(); } public interface Interface1 { //implementation …
0
votes
2 answers

Mock a large Partial Class

I want to make a unit test for a Controller method that have 3 database calls. But each database call is done by asking a large Partial Class file, which name is DAL. The Dal class have like 70 methods! Do I have to make a Interface with 70 methods,…
Olof84
  • 919
  • 4
  • 14
  • 29
0
votes
0 answers

custom data annotation in partial metadata not working

I am implementing a custom data annotation and in the main model it works correctly, but when I put the data annotation in the partial metada the validation does not find this data annotation. my code is as follows: public partial class register { …
Geo
  • 309
  • 4
  • 22
0
votes
1 answer

how to create object of partial class in c#.net?

What exactly is the partial class in c#.net? create button { call constorctor } To create object of partial class in c#.net while using windows form application.