什么是硬编码路径? [英] what is hard-coded path ?

查看:143
本文介绍了什么是硬编码路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

c Sharp中隔离存储类中的硬编码路径是什么

what is hard-coded path in isolated storage classes in c sharp

推荐答案

阅读此处:
隔离存储 [ C#.NET教程8:使用隔离存储 [ ^ ]
Read here:
Isolated Storage[^]
C# .NET Tutorial 8: Working with Isolated Storage[^]


您是否想知道文件是由隔离存储存储的?试试这个:

Do you want to know here files are stored by the isolated store? Try this:

public static string GetIsoStoragePath()
{
    var path = string.Empty;
    using(var isoStore = IsolatedStorageFile.GetUserStoreForAssembly())
    {
       var rootDirProperty = isoStore.GetType().GetProperty("RootDirectory", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
      var pathAsObject = rootDirProperty.GetValue(isoStore, null);
      path = pathAsObject.ToString();
    }   
    return path;
}


这是人们阅读随机文章但从未阅读过基础知识时发生的一个示例.硬编码意味着它是在代码中指定的,不是作为可以更改的变量,而是作为静态值.考虑购买一些基本参考资料并阅读它们.
This is an example of what happens when people read random articles but never read up on the basics. Hard coded means it''s specified in code, not as a variable that can be changed, but as a static value. Consider buying some basic references and reading them.


这篇关于什么是硬编码路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆