Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7071183
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:39:26+00:00 2026-05-28T05:39:26+00:00

Is there an easy built-in-way of combining paths for using them as a single

  • 0

Is there an easy “built-in-way” of combining paths for using them as a single parameter?

I use an own Implementation called SpringPathCombiner to do the following:

<property name="CombinedPath">
  <object type="SpringExt.SpringPathCombiner, SpringExt">
    <constructor-arg name="path1">
      <object factory-method="GetBasePath" factory-object="MyConfig" />
    </constructor-arg>
    <constructor-arg name="path2" value="Temp" />
  </object>
</property>

This will set the Combined path to the combination of the return value of the
method GetBasePath together with “Temp”, e.g. C:\MyBasePath\Temp.

The SpringPathCombiner class itself is very simple:

public class SpringPathCombiner
{
    private readonly string path;

    public SpringPathCombiner(string path1, string path2)
    {
        path = Path.Combine(path1, path2);
    }

    public static implicit operator string(SpringPathCombiner combiner)
    {
        return combiner.path;
    }

    public override string ToString()
    {
        return path;
    }
}

But I don’t want to have code duplication and I think there must by a way to do this kind of job with the things brought by Spring itself. Anyone knows a way how to do this without an own implementation, e.g. using Path.Combine directly?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T05:39:26+00:00Added an answer on May 28, 2026 at 5:39 am

    Have you tried using an expression? For example:

    <object id="MyObject" type="q8892913.MyClass, q8892913">
      <property name="Path" expression="T(System.IO.Path).Combine('c:\dev', 'Temp')" />
    </object>
    

    You can easily use properties of other objects too:

    <object id="MyObject" type="q8892913.MyClass, q8892913">
      <property name="Path" expression="T(System.IO.Path).Combine(@(MyConfig).Path, 'Temp')" />
    </object>
    
    <object id="MyConfig" type="q8892913.MyClass, q8892913">
      <property name="Path" value="c:\dev" />
    </object>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there an easy (built-in) way to convert 21-Feb-12 to %d-%m-%Y using datetime and/or
Is there an easy way (maybe built in solution) to convert TimeSpan to localized
Is there an easy way to use DirectX in Java? In particular, DirectX's video
Is there an easy way to read a single char from the console as
Is there an easy way to use Spring IoC for a factory which returns
I'd like to know if there's a easy (built-in) way to when reverting to
Is there an easy way to read these integers in? I'd prefer a built
Is there an easy way to check in a unit test that two arrays
Is there an easy way to detect when a .NET app gets or loses
Is there an easy way to set the volume from managed .net code?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.