Click here to Skip to main content
15,915,160 members
Home / Discussions / C#
   

C#

 
AnswerRe: RegExReplace \K (discard what has been matched so far) workaround / Alternative Pin
Lupu5R3x24-Jan-20 7:47
Lupu5R3x24-Jan-20 7:47 
GeneralRe: RegExReplace \K (discard what has been matched so far) workaround / Alternative Pin
Gerry Schmitz24-Jan-20 8:09
mveGerry Schmitz24-Jan-20 8:09 
GeneralRe: RegExReplace \K (discard what has been matched so far) workaround / Alternative Pin
Lupu5R3x24-Jan-20 8:21
Lupu5R3x24-Jan-20 8:21 
GeneralRe: RegExReplace \K (discard what has been matched so far) workaround / Alternative Pin
Gerry Schmitz24-Jan-20 8:39
mveGerry Schmitz24-Jan-20 8:39 
GeneralRe: RegExReplace \K (discard what has been matched so far) workaround / Alternative Pin
Lupu5R3x24-Jan-20 8:45
Lupu5R3x24-Jan-20 8:45 
QuestionCrystal Report Load Report failed error Pin
Member 1466074223-Jan-20 16:59
Member 1466074223-Jan-20 16:59 
AnswerRe: Crystal Report Load Report failed error Pin
Pete O'Hanlon23-Jan-20 21:25
mvePete O'Hanlon23-Jan-20 21:25 
AnswerRe: Crystal Report Load Report failed error Pin
thatraja28-Jan-20 1:37
professionalthatraja28-Jan-20 1:37 
QuestionI want to communicate with Graphdata from C# Core Pin
anil15087523-Jan-20 7:05
professionalanil15087523-Jan-20 7:05 
AnswerRe: I want to communicate with Graphdata from C# Core Pin
ZurdoDev23-Jan-20 7:35
professionalZurdoDev23-Jan-20 7:35 
GeneralRe: I want to communicate with Graphdata from C# Core Pin
anil15087528-Jan-20 6:55
professionalanil15087528-Jan-20 6:55 
QuestionCAS REST API with C' shared login Ticket with Internet explorer or Edge Pin
MeAndCode23-Jan-20 3:19
MeAndCode23-Jan-20 3:19 
QuestionDialogfenster auf- und zuklappen (Open and close dialog window) Pin
CopWorker23-Jan-20 0:36
CopWorker23-Jan-20 0:36 
AnswerRe: Dialogfenster auf- und zuklappen (Open and close dialog window) Pin
Gerry Schmitz23-Jan-20 4:11
mveGerry Schmitz23-Jan-20 4:11 
QuestionMessage Removed Pin
22-Jan-20 22:24
professionalmeeram3922-Jan-20 22:24 
QuestionGet Data From Deserialized List By Type Pin
Kevin Marois22-Jan-20 8:45
professionalKevin Marois22-Jan-20 8:45 
AnswerRe: Get Data From Deserialized List By Type Pin
Richard Deeming22-Jan-20 9:01
mveRichard Deeming22-Jan-20 9:01 
GeneralRe: Get Data From Deserialized List By Type Pin
Kevin Marois22-Jan-20 9:15
professionalKevin Marois22-Jan-20 9:15 
GeneralRe: Get Data From Deserialized List By Type Pin
Kevin Marois22-Jan-20 11:12
professionalKevin Marois22-Jan-20 11:12 
The problem I see is that there's no way to make the Data property generic.

I can get all of the types like this:
private void LoadDataFromFile(string fileName)
{
    try
    {
        // Lists
        List<RuleGroupEntity> groups = new List<RuleGroupEntity>();
        List<RuleConfigurationEntity> configs = new List<RuleConfigurationEntity>();
        List<RuleDefinitionEntity> definitions = new List<RuleDefinitionEntity>();

        // Deserialize into the Groups
        groups = Serialization.DeSerializeObject<List<RuleGroupEntity>>(fileName);

        // Go through all the data and load the lists
        foreach (var group in groups)
        {
            configs.AddRange(group.RuleConfigurations);

            foreach (var config in group.RuleConfigurations)
            {
                definitions.Add(config.RuleDefinition);
            }
        }

        // Get the parameter type
        Type parameterType = typeof(T);

        // If T is Configurations, the load the Data T property with the configs list
        if (parameterType == typeof(RuleConfigurationEntity))
        {
            Data = (T)Activator.CreateInstance(typeof(T), configs); // <== Something like this is what I want.
        }
    }
    catch (Exception e)
    {
    }
}
But I then need to assign one of those lists to Data T. Not sure how to convert that.
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.

GeneralRe: Get Data From Deserialized List By Type Pin
Richard Deeming23-Jan-20 0:48
mveRichard Deeming23-Jan-20 0:48 
GeneralRe: Get Data From Deserialized List By Type Pin
Kevin Marois23-Jan-20 7:35
professionalKevin Marois23-Jan-20 7:35 
GeneralRe: Get Data From Deserialized List By Type Pin
Richard Deeming23-Jan-20 9:34
mveRichard Deeming23-Jan-20 9:34 
GeneralRe: Get Data From Deserialized List By Type Pin
Kevin Marois23-Jan-20 7:51
professionalKevin Marois23-Jan-20 7:51 
AnswerRe: Get Data From Deserialized List By Type Pin
BillWoodruff22-Jan-20 21:44
professionalBillWoodruff22-Jan-20 21:44 
AnswerRe: Get Data From Deserialized List By Type Pin
Gerry Schmitz23-Jan-20 4:14
mveGerry Schmitz23-Jan-20 4:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.