Как узнать «путь» встроенного ресурса?
Я ловлю себя на том, что csharp каждый раз забываю, как это c# сделать, поэтому я просто visual-c# оборачиваю две строчки, которые .net-framework мне нужны, в небольшой класс:
public class Utility
{
///
/// Takes the full name of a resource and loads it in to a stream.
///
/// Assuming an embedded resource is a file
/// called info.png and is located in a folder called Resources, it
/// will be compiled in to the assembly with this fully qualified
/// name: Full.Assembly.Name.Resources.info.png. That is the string
/// that you should pass to this method.
///
public static Stream GetEmbeddedResourceStream(string resourceName)
{
return Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName);
}
///
/// Get the list of all emdedded resources in the assembly.
///
/// An array of fully qualified resource names
public static string[] GetEmbeddedResourceNames()
{
return Assembly.GetExecutingAssembly().GetManifestResourceNames();
}
}
c#
.net
resources
2021-12-03T08:28:10+00:00
2022-11-01T01:17:18+00:00
Pukanello
Вопросы с похожей тематикой, как у вопроса:
Как узнать «путь» встроенного ресурса?
Предупреждение о файлах Cookies
Мы используем файлы cookies для улучшения работы сайта. Оставаясь на нашем сайте, вы соглашаетесь с условиями использования файлов cookies. Чтобы ознакомиться с нашими Положениями о конфиденциальности и об использовании файлов cookie, нажмите здесь.