When it is the case that you want to use any kind of external file, there is certainly a way to put them in a folder within your project, but not as valid as getting them from resources. In a regular Visual Studio project, you should have a Resources.resx
file under the Properties
section, if not, you can easily add your own Resource.resx
file. And add any kind of file in it, you can reach the walkthrough for adding resource files to your project here.
After having resource files in your project, calling them is easy as this:
var myIcon = Resources.MyIconFile;
Of course you should add the using Properties
statement like this:
using <namespace>.Properties;
Related Posts:
- Error : Could not load file or assembly or one of it’s dependencies
- Unity OnTriggerEnter2D not registering
- Configuration System Failed to Initialize
- How to add a default Default.aspx to a ASP.NET Web Application Project?
- Visual Studio /**/ comment shortcut?
- “Error while trying to run project: Unable to start program”. Can run program only once. Then VS needs restart
- Can’t use System.Windows.Forms
- How do I create a Shared Code project (.shproj)
- How do I remedy “The breakpoint will not currently be hit. No symbols have been loaded for this document.” warning?
- Visual studio 2019 freezes when debugging
- Visual Studio: The Operation could not be completed. The parameter is incorrect
- C# – How to convert string to char?
- What is the purpose of the vshost.exe file?
- “A project with an Output type of Class Library cannot be started directly”
- “A project with an Output type of Class Library cannot be started directly”
- How to make a simple popup box in Visual C#?
- Receiving access denied error from Visual Studio when trying to change target framework
- Visual Studio keeps crashing
- How can we generate getters and setters in Visual Studio?
- C# Debug – cannot start debugging because the debug target is missing
- The name ‘ViewBag’ does not exist in the current context – Visual Studio 2015
- Why am I getting ‘Assembly ‘*.dll’ must be strong signed in order to be marked as a prerequisite.’?
- Create html documentation for C# code
- The provider did not return a ProviderManifestToken string Entity Framework
- Unity 5.2.2 changing Visual Studio back to MonoDevelop
- Where can I read the Console output in Visual Studio 2015
- Go To Definition: “Cannot navigate to the symbol under the caret.”
- Unity Scripts edited in Visual studio don’t provide autocomplete
- How to show a loading gif while an APi is being called in xamarin android?
- What is the { get; set; } syntax in C#?
- Can anyone explain IEnumerable and IEnumerator to me? [closed]
- Getting mouse position in unity
- How to make the script wait/sleep in a simple way in unity
- Could not load file or assembly or one of its dependencies
- All possible array initialization syntaxes
- What are the benefits to marking a field as `readonly` in C#?
- How to resolve “Input string was not in a correct format.” error?
- failed to load resource: the server response with a status 500 (internal server error)
- C# compiler error: “not all code paths return a value”
- What is the purpose of nameof?
- Converting a String to DateTime
- Error 1053 the service did not respond to the start or control request in a timely fashion
- Only one usage of each socket address (protocol/network address/port) is normally permitted?
- Why should I use SerializeField?
- C# equivalent of C++ vector, with contiguous memory?
- The client and server cannot communicate, because they do not possess a common algorithm – ASP.NET C# IIS TLS 1.0 / 1.1 / 1.2 – Win32Exception
- Cannot implicitly convert type ‘customtype’ to ‘othercustomtype’
- Metadata file ‘.dll’ could not be found
- C# List
to string with delimiter - Convert a list of strings to a single string
- Incorrect string value: ‘\xEF\xBF\xBD’ for column
- How do I declare a DefaultValue attribute whose value is an array of strings?
- Unity3d restart current scene
- Easiest way to alter eBay page content/DOM
- Why does var evaluate to System.Object in “foreach (var row in table.Rows)”?
- MSHTML DLL on Windows 10
- Unity 2d jumping script
- ..The underlying connection was closed: An unexpected error occurred on a receive
- How to add a delay for a 2 or 3 seconds
- Select distinct using linq
- What are Virtual Methods?
- SQL Insert Query Using C#
- How to round up the result of integer division?
- Read and parse a Json File in C#
- Passing just a type as a parameter in C#
- How to declare session variable in C#?
- Cannot open database “test” requested by the login. The login failed. Login failed for user ‘xyz\ASPNET’
- Writing data into CSV file in C#
- System.Data.SqlClient.SqlException: Login failed for user
- C# Print list of string array
- finding the maximum length of lists in c#
- Creating a comma separated list from IList
or IEnumerable - Randomize a List
- Conversion of a datetime2 data type to a datetime data type results out-of-range value
- JSON.NET Error Self referencing loop detected for type
- entity object cannot be referenced by multiple instances of IEntityChangeTracker. while adding related objects to entity in Entity Framework 4.1
- What does ModelState.IsValid do?
- Error Message: Type or namespace definition, or end-of-file expected
- Make first letter of a string upper case (with maximum performance)
- ‘An exception occurred during a WebClient request” while using C# ASP.NET
- How to download image from URL
- Is there an equivalent to the Scanner class in C# for strings?
- The opposite of the modulo operator?
- How can I implement static methods on an interface?
- How to add List<> to a List<> in asp.net [duplicate]
- get path for my .exe
- AddTransient, AddScoped and AddSingleton Services Differences
- Critical error detected c0000374 – C++ dll returns pointer off allocated memory to C#
- Linq select objects in list where exists IN (A,B,C)
- Unable to determine the principal end of an association between the types
- What is a quick way to force CRLF in C# / .NET?
- How to enable assembly bind failure logging (Fusion) in .NET
- How to make inline functions in C#
- C# Convert List
to Dictionary - Differences between SFTP and “FTP over SSH”
- When should I use a List vs a LinkedList
- What should I use an IEnumerable or IList? [duplicate]
- Convert JSON String to JSON Object c#
- C# Encoding a text string with line breaks
- member names cannot be the same as their enclosing type C#