C
C#3y ago
Dreto

How can i achieve something like this

public class Test
{
public string Name{get;set;}
}

//And i want to do
Test.Add(new string Surname)

//Result
public class Test
{
public string Name{get;set;}
public string Surname{get;set;}
}
public class Test
{
public string Name{get;set;}
}

//And i want to do
Test.Add(new string Surname)

//Result
public class Test
{
public string Name{get;set;}
public string Surname{get;set;}
}
7 Replies
mtreit
mtreit3y ago
Uh...what?
Dreto
DretoOP3y ago
Mhmhm how do i explain this .... I got a class and i want to add to it like modify it depending on an event lets say a foreach
mtreit
mtreit3y ago
You want to programmatically add a property to an existing type definition? At runtime?
Dreto
DretoOP3y ago
yea
mtreit
mtreit3y ago
That's not really a thing
Dreto
DretoOP3y ago
owh K well there goes my idea anyway thx
mtreit
mtreit3y ago
You can implement something like a property bag Essentially a set of name / value pairs
Want results from more Discord servers?
Add your server