442 questions
-1
votes
3
answers
70
views
Why is this new control not referenceable in the codebehind? [duplicate]
I am taking over an old ASP.NET solution that is running in the 4.7.2 framework. My last intimate familiarity with ASP.NET was some years ago, using 2.0. I find there is something I don't understand ...
0
votes
1
answer
105
views
How do I call emit() from a partial class(extension MyCubitExtension on MyCubit) whose parent class extends Cubit<MyState> in Flutter?
At first, I had my_cubit.dart file but it was getting too long so I decided to divide it.
Now I have two files: my_cubit.dart, my_cubit.extension.dart as below
my_cubit.dart:
part 'my_cubit.extension....
0
votes
0
answers
102
views
Maui partial class false compiler errors that do not prevent build and deploy
Partial method 'PlatformSpecificHelper.Close()' must have an implementation part because it has accessibility modifiers.
I am getting an error like this for every single method in my Static ...
2
votes
1
answer
959
views
Maui class library: Partial Method issue
In the MAUI class library, within the platform-specific code, I have the following class:
public partial class Connector
{
internal partial void ReadData(string command, Action<string, string&...
2
votes
1
answer
1k
views
CS8795 Error with Partial Class on MAUI-8.0
I am trying to prototype a functionality that would allow me to send an SMS in the background on Android with .NET MAUI-8.0 but I am having trouble utilizing the approach where I use partial classes.
...
1
vote
0
answers
94
views
How to add filename in output command?
I'm working on a group of client/server applications, who are constantly exchanging messages. In order to follow this, I've added the following line on every place a message is to be sent:
if (...
0
votes
1
answer
323
views
Source Generators: How can I prevent the instantiation of a base class declared as "partial" in C#?
Summary
I have a base class which inherits from an abstract class, but must itself be declared as partial, because I'm using Source Generators to generate parts of the implementation.
How can I ...
1
vote
2
answers
146
views
Is it possible to add to/change the functionality of a method through a partial class?
I have been working on a nuget-package that helps with sending information to Azure's READ-API.
The package itself is done and works great, however I want to add some more optional functionality.In ...
1
vote
2
answers
205
views
Type 'undefined' cannot be used as an index type. Partial<Class> undefined?
I searched a lot but couldn't find. My Codes as below.
I created one alertify Service but I get the following error: "Type 'undefined' cannot be used as an index type. Partial<Class> ...
-1
votes
1
answer
91
views
Partial class problem in c# : not possible to invoke a method correctly
I'm new to c# and just started studying the partial classes topic.
Made some practice but I dont understand why when I do run a programm the console stamps only the method from the 1st partial class ...
1
vote
1
answer
612
views
Correct class name for the code-behind partial class to correspond to the one specified in the XAML file?
I am following this tutorial here: https://prismlibrary.com/docs/wpf/getting-started.html
It first modifies the class used in App.xaml as follows:
<prism:PrismApplication
x:Class="WpfApp1....
4
votes
2
answers
2k
views
Partial platform specific methods in .NET MAUI
I'm trying to implement plattform specific partial method in .NET MAUI to get the connection string for the database.
In the "main application":
namespace TestApp.DL;
public partial class ...
1
vote
1
answer
253
views
Using ref in (whole) partial class
I got some confusion about "the right way" to use a reference in a partial class.
Basically i wrote a WPF program which has different Menus. Every Menu got the same Viewmodel and some data-...
2
votes
1
answer
252
views
TypeScript Recursive Partial confused when Classes share a property name
I've been using a Conditional Type in TypeScript to create a Recursive Partial. The issue I'm having is hard to explain without an example, so please see the code below (note: my particular use case ...
1
vote
1
answer
204
views
C#. Windows Form. Partial class problem when migration from .NET 4.6.1 to 4.6.2
I try to modify Target framework from .NET 4.6.1 to 4.6.2 in Project Properties window of VS2019.
Compilation of version 4.6.1 is OK.
Compilation of version 4.6.2 fails: error CS0101: The namespace '...
0
votes
0
answers
99
views
Why can a partial class only contain partial classes?
I struggle to understand, why a class with the partial modifier, can not contain classes that are not partial. They don't need to necessarily have their definition spread across multiple files.
...
2
votes
0
answers
3k
views
'InvalidOperationException: Multiple constructors accepting all given argument types err..' error and ActivatorUtilitiesConstructor attribute was used
I have two partial class files for the Client class. Client is registered with DI in .NET 6.
I am getting an error:
InvalidOperationException: Multiple constructors accepting all given argument types ...
0
votes
1
answer
728
views
Partial Class Winform Form
It was taught to me that any alterations to an object on a form (change the text, make visible/invisible or change the color and so on) should be done in the corresponding form class.
But due to the ...
0
votes
0
answers
81
views
Partial classes- Member with same name already exist errors
I am trying to change a website to a web application but seems to get lot of issues as some of the subroutines are in both partial classes spread across different files.
Just wondering why it didn't ...
1
vote
2
answers
404
views
C#: accessing Dictionary by using a partial class
I'm trying to access a Dictionary in the following way, by using a partial class. The end purpose of this is to expose this dictionary and allow different methods to directly read/write from/to it.
...
0
votes
1
answer
720
views
Can you extend a non partial method in a partial class?
I have a generated partial class
public partial interface IPartialInterface
{
Task<object> Method(string param)
}
public partial class PartialClass : IPartialInterface
{
public Task<...
-1
votes
2
answers
89
views
What is the importance of using the partial keyword when dealing with generated code files?
Microsoft's docs state some reasons why it's a good idea to use partial, one of which deals with generated code files.
When working with automatically generated source, code can be added to the class ...
2
votes
1
answer
183
views
Is it possible to add more documentation to existing methods or classes in C#?
Suppose I am developing a C# library targeting two different platforms (lets say, WinForms and Blazor).
One way to structure the code is to have a "core" set of common files that are partial ...
4
votes
1
answer
2k
views
Inherited base class that inherits ComponentBase in partial class gives error
I am working with a something.razor file and a code behind Something.razor.cs file. My partial class inherits from SomethingBase which itself inherits from ComponentBase.
This however gives errors
...
0
votes
0
answers
183
views
Separate Custom Code From Entity Framework Generated Classes
Entity Framework generates a code file for my database .edmx, it creates for each entity .. If I customize some properties (change column names, makes required properties ... etc) as example I have ...
7
votes
3
answers
2k
views
Roslyn analyzer: Is class marked as partial
Is there a way to find out whether class is partial inside Roslyn analyzer?
There is a PartialImplementationPart in IMethodSymbol, but nothing similar for INamedTypeSymbol.
I'm writing a Source ...
2
votes
2
answers
1k
views
How to split a parent class that implements an abstract class in Dart Flutter?
I want to use some partial classes in Flutter but somehow it does not work with an implemented abstract class. I give an example
my_interface.dart
abstract class MyInterface {
void method1();
void ...
-3
votes
1
answer
469
views
partial class constructor not calling the base [closed]
MyClass.cs:
namespace ConsoleApp
{
public partial class MyClass
{
public string Name { get; set; }
public MyClass()
{
Name = "base";
}
}
}
MyClass2.cs:
...
0
votes
0
answers
277
views
ASP.NET partial class conflict
Recently in a ASP.NET project i have created an ASPX page and the IDE created the code behind file for me.
I opened that file and see that it's a partial class with the same name of aspx page but with ...
0
votes
3
answers
439
views
Combining two classes that have partial classes inside
Not really sure how to phrase the title sorry.
I have two classes I generated from a JSON to c# online converter. These classes are so I can deserialise some JSON objects and turn them into objects I ...
0
votes
1
answer
562
views
MetadataType don't work with partial class in ASP.NET MVC
Hi I've a problem with MetadataType with my partial class
In my asp.net mvc project i have a class library (Infrastructure) with a DB directory who contain my partial class scafolded from the DB
...
2
votes
0
answers
515
views
Using private static members across partial classes [duplicate]
I have partial classes with static readonly fields, and in one of the partial classes I'm creating a static readonly list of all the static readonly members. For some reason, the list ends up with the ...
0
votes
1
answer
185
views
Create TypeScript index type whose properties `[key of Y]: Partial<X>`, when each combined with a `default: Partial<X>` property, are not partials
Consider the following type definitions in TypeScript:
enum Environment {
Local = 'local',
Prod = 'prod'
}
type EnvironmentConfig = {
isCustomerFacing: boolean,
serverUrl: string
}
type ...
0
votes
2
answers
372
views
Invoking an event from partial class is not possible [duplicate]
I have the following class structure:
public abstract class Base : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
}
internal partial ...
1
vote
1
answer
822
views
C# - private static method in partial class not shared between files?
I'm creating static partial class like this.
If I put them in the same file there is no problem, but when I move one class to another file in the same project, this method private_method_from_a() does ...
0
votes
1
answer
155
views
Generic implementation to Avoid Lazy Loading in EF with multiple Database Context (using partial class)
In my project I do have many Database Contexts.
1. MyContext1
2. MyContext2
3. MyContext3
I am currently using database first approach (edmx based).
As part of edmx creation all these contexts are ...
1
vote
3
answers
2k
views
How would I process two classes that are exactly the same except by name?
I am writing a service in Core 3.1. In the service that I am writing, I create a connected service to a legacy SOAP service that interfaces with an even older system. The SOAP service provides basic ...
0
votes
0
answers
568
views
Call a web service in C#
I want to call a web service from C#. I have added the WS by adding service reference. The WS has generated automatically the code below.
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System....
0
votes
1
answer
881
views
How to have Different Partial classes use a Base Class to override same partial Method?
After research and this answer by Mr. Skeet I don't think this is possible, I just wanted to double check with the community if I missed something or if I can simplify redundant partial method ...
-3
votes
1
answer
1k
views
Is there any way to Write same property name in partial class in C#?
My Auto Generated Class
public partial class Address
{
public int Id { get; set; }
public string Name { get; set; }
}
And I want following output. And I don't take same property name in my ...
2
votes
4
answers
7k
views
extend class in c# with properties
I use Entity framework 6 (database first) in my mvc project. The database has a table called User which has columns like name, adress, email. In my project I therefore have the User.cs class auto ...
1
vote
2
answers
1k
views
WCF serialization of decimal to string with 2 decimal precision
We are connecting to an external system that provides a WSDL that expects decimals to be provided to 2 decimal places - i.e.:
<collectionAmount>1000.00</collectionAmount>
However, when ...
0
votes
2
answers
2k
views
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. ...
0
votes
0
answers
80
views
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 ...
0
votes
1
answer
1k
views
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 ...
2
votes
1
answer
1k
views
Class instance fails isinstance check [closed]
Hi
I have some code on my CI failing (local runs do not fail).
The problem is that class instance fails isinstance() check.
Code:
File: main.py
class MyController(SuperController):
# Overrides ...
0
votes
0
answers
1k
views
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 ...
1
vote
2
answers
3k
views
Can we have multiple (more than two) partial classes in c#? [duplicate]
Suppose there are 3 members in a team and all of them wants to work on a same class. So in this case can we use more than 2 partial class in c#?
0
votes
0
answers
90
views
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 ...
1
vote
1
answer
572
views
How to extend POCO generated by Reverse POCO Generator?
I used Reverse POCO Generator to generate pocos for my project (partial classes) .
Then, I extended one of my pocos by creating a new partial class (new file) with the same class name and in the same ...