samedi 26 janvier 2019

Write once the variables in the program and reuse them in the entire program

Hello friends .

I need to do this in one of my classes to access the folder for photos in any method. I want to do these things in another class. I need to define and value these variables and use them in the whole program. How should I do that?

    string RootFolderName = "Uplaod";
    string ProductPictureFolder = "ProductPictureFolder";
    string ProductMainPictureFolder = "ProductMainPicture";
    string WebRootPath = _hostingEnvironment.WebRootPath;
    string RootPath = Path.Combine(WebRootPath, RootFolderName);
    string ProductPicturePath = Path.Combine(WebRootPath, RootFolderName, ProductPictureFolder);
    string ProductMainPicturePath = Path.Combine(WebRootPath, RootFolderName, ProductPictureFolder, ProductMainPictureFolder);
    string newPath = Path.Combine(WebRootPath, ProductMainPicturePath);

Aucun commentaire:

Enregistrer un commentaire