C
C#15mo ago
arch_il

✅ cannot be accessed with an instance reference

public static class Details
{
// class for drawing event
public class EventDrawModel
{
public static string title { get; set; }
}

// model for drawing event
private static EventDrawModel eventDrawModel = new EventDrawModel();

// this is specific update func only called when selected event is changed
public static void Update()
{
Details.eventDrawModel.title = "";
}
}
public static class Details
{
// class for drawing event
public class EventDrawModel
{
public static string title { get; set; }
}

// model for drawing event
private static EventDrawModel eventDrawModel = new EventDrawModel();

// this is specific update func only called when selected event is changed
public static void Update()
{
Details.eventDrawModel.title = "";
}
}
Member 'Details.EventDrawModel.title' cannot be accessed with an instance reference; qualify it with a type name instead
Member 'Details.EventDrawModel.title' cannot be accessed with an instance reference; qualify it with a type name instead
How would one fix this issue?
2 Replies
Uchuu
Uchuu15mo ago
I am not too sure what you're doing, but it seems that title is a static property It should be accessed from the class itself rather than an instance of that class
arch_il
arch_il15mo ago
oh my bad. i should probably take a break thx for help
Want results from more Discord servers?
Add your server
More Posts
✅ MVVM Source Generator not copying attributesIt seems that if you do ```csharp [ObservableProperty, JsonIgnore] private ImageSource _MyBadPrope❔ error CS1525: Unexpected symbol `String'using System; public String DuplicateCount(string input) { foreach (char a in input) {❔ Newtonsoft json own read write methodHi there I want to serialized my struct to a json file and add support so specific types / field use❔ Calculating reading duration percentages for different time periodsI'm working on a project where I need to calculate the reading duration percentages for different ti❔ C# Rewrite ODT Links and download associated filesHello, I have a problem for several weeks on my c# code, my application is used to read an ODT file ❔ How to verify data according to DDD, SOLID and Clean Architecture?I own in two places one IF, it is: ```cs if(credential.Status != Credential.StatusType.Verified) ```✅ ✅ I can't display message in my dropdown if no data availablehttps://stackoverflow.com/questions/76199462/i-cant-display-message-in-my-dropdown-if-no-data-availa❔ Draggable markers on Gmap.NETI am using Gmap.NET and I'm trying to make the markers become draggable on the GUI. Any idea how to ❔ Using Allure for my tests but loading the report doesn’t usually workUsually when i try to open my report using “allure open “allure-report”” The server starts but acce❔ Using inheritance in my projectI'm building a book shelf project and I need help with modifying my ctor so I could assign each inpu