Storing a Lambda Expression in a Variable

前端 未结 3 1798
野性不改
野性不改 2020-12-30 18:39

I think my brain has become fried as i\'m struggling to do something simple. In my application i have the following code to configure Nhibernate (my issue is not specific t

3条回答
  •  梦毁少年i
    2020-12-30 19:08

    Sure. Assuming _configuration is going to store what you were using in your first bit of code. It should look something like this:

    return Fluently.Configure().ExposeConfiguration(c => {
    c.EventListeners.PostInsertEventListeners = _configuration;
    c.EventListeners.PostUpdateEventListeners = _configuration;});
    

    If there are any kind of cast errors from the compiler, you can always use:

    _configuration.Cast();
    

提交回复
热议问题