Create INI file for use in C#.NET
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
just wanted some help in creating a INI file in windows using notepad to declare paths used for files/directories for a C#.NET application in Visual Studio.
Currently the program uses hard-coded paths in the application to location of files (on the network drives) used for input and output. What I want to do is use this INI file to declare these locations for files on my local machine so I can test out the program and then read it by the C#.NET program without modifying the production source code.
How do I go about doing this and how is it used once file is created?
Thanks
c# .net visual-studio ini
|
show 2 more comments
just wanted some help in creating a INI file in windows using notepad to declare paths used for files/directories for a C#.NET application in Visual Studio.
Currently the program uses hard-coded paths in the application to location of files (on the network drives) used for input and output. What I want to do is use this INI file to declare these locations for files on my local machine so I can test out the program and then read it by the C#.NET program without modifying the production source code.
How do I go about doing this and how is it used once file is created?
Thanks
c# .net visual-studio ini
4
Over the last 20 years a number of better storage mechanisms than INI files have been developed such as XML, JSON, binary serialization and evenSettings
– Nat Pongjardenlarp
Nov 15 '18 at 17:32
1
I know this feels like a broad swath of work; but if you break it down: You need a place to store your INI file. Look up how to do file creation/reading in C#. You then need to parse this INI File; meaning to learn the INI File format, or see if there's a C# parser for INI. Once you've done that, you need to load those INI settings into an object to use during the life of your application; again, that's an individual google search. (In .NET Core the Configuration Class can do this easily docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/… )
– George Stocker♦
Nov 15 '18 at 17:34
Welcome to StackOverflow! This is possible to achieve but we're here to help you, not to do it for you. Please show us what have you tried so far.
– Karel Tamayo
Nov 15 '18 at 17:34
Check Settings. It is much easier than reading writing ini files. msdn.microsoft.com/en-us/library/aa730869(v=vs.80).aspx
– Cetin Basoz
Nov 15 '18 at 17:38
1
The INI file format has massive amounts of appcompat associated with them. Reading a single setting from such a file takes 50 milliseconds on a spindle drive. That makes it unsuitable for use today. Use Project > Properties > Settings, press F1 to learn more.
– Hans Passant
Nov 17 '18 at 12:22
|
show 2 more comments
just wanted some help in creating a INI file in windows using notepad to declare paths used for files/directories for a C#.NET application in Visual Studio.
Currently the program uses hard-coded paths in the application to location of files (on the network drives) used for input and output. What I want to do is use this INI file to declare these locations for files on my local machine so I can test out the program and then read it by the C#.NET program without modifying the production source code.
How do I go about doing this and how is it used once file is created?
Thanks
c# .net visual-studio ini
just wanted some help in creating a INI file in windows using notepad to declare paths used for files/directories for a C#.NET application in Visual Studio.
Currently the program uses hard-coded paths in the application to location of files (on the network drives) used for input and output. What I want to do is use this INI file to declare these locations for files on my local machine so I can test out the program and then read it by the C#.NET program without modifying the production source code.
How do I go about doing this and how is it used once file is created?
Thanks
c# .net visual-studio ini
c# .net visual-studio ini
asked Nov 15 '18 at 17:30
Rashmi PatelRashmi Patel
64
64
4
Over the last 20 years a number of better storage mechanisms than INI files have been developed such as XML, JSON, binary serialization and evenSettings
– Nat Pongjardenlarp
Nov 15 '18 at 17:32
1
I know this feels like a broad swath of work; but if you break it down: You need a place to store your INI file. Look up how to do file creation/reading in C#. You then need to parse this INI File; meaning to learn the INI File format, or see if there's a C# parser for INI. Once you've done that, you need to load those INI settings into an object to use during the life of your application; again, that's an individual google search. (In .NET Core the Configuration Class can do this easily docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/… )
– George Stocker♦
Nov 15 '18 at 17:34
Welcome to StackOverflow! This is possible to achieve but we're here to help you, not to do it for you. Please show us what have you tried so far.
– Karel Tamayo
Nov 15 '18 at 17:34
Check Settings. It is much easier than reading writing ini files. msdn.microsoft.com/en-us/library/aa730869(v=vs.80).aspx
– Cetin Basoz
Nov 15 '18 at 17:38
1
The INI file format has massive amounts of appcompat associated with them. Reading a single setting from such a file takes 50 milliseconds on a spindle drive. That makes it unsuitable for use today. Use Project > Properties > Settings, press F1 to learn more.
– Hans Passant
Nov 17 '18 at 12:22
|
show 2 more comments
4
Over the last 20 years a number of better storage mechanisms than INI files have been developed such as XML, JSON, binary serialization and evenSettings
– Nat Pongjardenlarp
Nov 15 '18 at 17:32
1
I know this feels like a broad swath of work; but if you break it down: You need a place to store your INI file. Look up how to do file creation/reading in C#. You then need to parse this INI File; meaning to learn the INI File format, or see if there's a C# parser for INI. Once you've done that, you need to load those INI settings into an object to use during the life of your application; again, that's an individual google search. (In .NET Core the Configuration Class can do this easily docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/… )
– George Stocker♦
Nov 15 '18 at 17:34
Welcome to StackOverflow! This is possible to achieve but we're here to help you, not to do it for you. Please show us what have you tried so far.
– Karel Tamayo
Nov 15 '18 at 17:34
Check Settings. It is much easier than reading writing ini files. msdn.microsoft.com/en-us/library/aa730869(v=vs.80).aspx
– Cetin Basoz
Nov 15 '18 at 17:38
1
The INI file format has massive amounts of appcompat associated with them. Reading a single setting from such a file takes 50 milliseconds on a spindle drive. That makes it unsuitable for use today. Use Project > Properties > Settings, press F1 to learn more.
– Hans Passant
Nov 17 '18 at 12:22
4
4
Over the last 20 years a number of better storage mechanisms than INI files have been developed such as XML, JSON, binary serialization and even
Settings
– Nat Pongjardenlarp
Nov 15 '18 at 17:32
Over the last 20 years a number of better storage mechanisms than INI files have been developed such as XML, JSON, binary serialization and even
Settings
– Nat Pongjardenlarp
Nov 15 '18 at 17:32
1
1
I know this feels like a broad swath of work; but if you break it down: You need a place to store your INI file. Look up how to do file creation/reading in C#. You then need to parse this INI File; meaning to learn the INI File format, or see if there's a C# parser for INI. Once you've done that, you need to load those INI settings into an object to use during the life of your application; again, that's an individual google search. (In .NET Core the Configuration Class can do this easily docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/… )
– George Stocker♦
Nov 15 '18 at 17:34
I know this feels like a broad swath of work; but if you break it down: You need a place to store your INI file. Look up how to do file creation/reading in C#. You then need to parse this INI File; meaning to learn the INI File format, or see if there's a C# parser for INI. Once you've done that, you need to load those INI settings into an object to use during the life of your application; again, that's an individual google search. (In .NET Core the Configuration Class can do this easily docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/… )
– George Stocker♦
Nov 15 '18 at 17:34
Welcome to StackOverflow! This is possible to achieve but we're here to help you, not to do it for you. Please show us what have you tried so far.
– Karel Tamayo
Nov 15 '18 at 17:34
Welcome to StackOverflow! This is possible to achieve but we're here to help you, not to do it for you. Please show us what have you tried so far.
– Karel Tamayo
Nov 15 '18 at 17:34
Check Settings. It is much easier than reading writing ini files. msdn.microsoft.com/en-us/library/aa730869(v=vs.80).aspx
– Cetin Basoz
Nov 15 '18 at 17:38
Check Settings. It is much easier than reading writing ini files. msdn.microsoft.com/en-us/library/aa730869(v=vs.80).aspx
– Cetin Basoz
Nov 15 '18 at 17:38
1
1
The INI file format has massive amounts of appcompat associated with them. Reading a single setting from such a file takes 50 milliseconds on a spindle drive. That makes it unsuitable for use today. Use Project > Properties > Settings, press F1 to learn more.
– Hans Passant
Nov 17 '18 at 12:22
The INI file format has massive amounts of appcompat associated with them. Reading a single setting from such a file takes 50 milliseconds on a spindle drive. That makes it unsuitable for use today. Use Project > Properties > Settings, press F1 to learn more.
– Hans Passant
Nov 17 '18 at 12:22
|
show 2 more comments
1 Answer
1
active
oldest
votes
maybe you could use App.config:
Try this:
<appSettings>
<add key="parametro_de_lo_que_sea" value="valor_que_sea" />
</appSettings>
In your application you could use AppSettings.Get to get value:
string obtain_value = System.Configuration.ConfigurationManager.AppSettings["parametro_de_lo_que_sea"];
Good luck !!
You would unlikely want to do such a thing when there is Settings.
– Cetin Basoz
Nov 15 '18 at 17:39
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53324960%2fcreate-ini-file-for-use-in-c-net%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
maybe you could use App.config:
Try this:
<appSettings>
<add key="parametro_de_lo_que_sea" value="valor_que_sea" />
</appSettings>
In your application you could use AppSettings.Get to get value:
string obtain_value = System.Configuration.ConfigurationManager.AppSettings["parametro_de_lo_que_sea"];
Good luck !!
You would unlikely want to do such a thing when there is Settings.
– Cetin Basoz
Nov 15 '18 at 17:39
add a comment |
maybe you could use App.config:
Try this:
<appSettings>
<add key="parametro_de_lo_que_sea" value="valor_que_sea" />
</appSettings>
In your application you could use AppSettings.Get to get value:
string obtain_value = System.Configuration.ConfigurationManager.AppSettings["parametro_de_lo_que_sea"];
Good luck !!
You would unlikely want to do such a thing when there is Settings.
– Cetin Basoz
Nov 15 '18 at 17:39
add a comment |
maybe you could use App.config:
Try this:
<appSettings>
<add key="parametro_de_lo_que_sea" value="valor_que_sea" />
</appSettings>
In your application you could use AppSettings.Get to get value:
string obtain_value = System.Configuration.ConfigurationManager.AppSettings["parametro_de_lo_que_sea"];
Good luck !!
maybe you could use App.config:
Try this:
<appSettings>
<add key="parametro_de_lo_que_sea" value="valor_que_sea" />
</appSettings>
In your application you could use AppSettings.Get to get value:
string obtain_value = System.Configuration.ConfigurationManager.AppSettings["parametro_de_lo_que_sea"];
Good luck !!
edited Nov 17 '18 at 11:56
Enrique González
13412
13412
answered Nov 15 '18 at 17:37
raBinnraBinn
6910
6910
You would unlikely want to do such a thing when there is Settings.
– Cetin Basoz
Nov 15 '18 at 17:39
add a comment |
You would unlikely want to do such a thing when there is Settings.
– Cetin Basoz
Nov 15 '18 at 17:39
You would unlikely want to do such a thing when there is Settings.
– Cetin Basoz
Nov 15 '18 at 17:39
You would unlikely want to do such a thing when there is Settings.
– Cetin Basoz
Nov 15 '18 at 17:39
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53324960%2fcreate-ini-file-for-use-in-c-net%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
4
Over the last 20 years a number of better storage mechanisms than INI files have been developed such as XML, JSON, binary serialization and even
Settings
– Nat Pongjardenlarp
Nov 15 '18 at 17:32
1
I know this feels like a broad swath of work; but if you break it down: You need a place to store your INI file. Look up how to do file creation/reading in C#. You then need to parse this INI File; meaning to learn the INI File format, or see if there's a C# parser for INI. Once you've done that, you need to load those INI settings into an object to use during the life of your application; again, that's an individual google search. (In .NET Core the Configuration Class can do this easily docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/… )
– George Stocker♦
Nov 15 '18 at 17:34
Welcome to StackOverflow! This is possible to achieve but we're here to help you, not to do it for you. Please show us what have you tried so far.
– Karel Tamayo
Nov 15 '18 at 17:34
Check Settings. It is much easier than reading writing ini files. msdn.microsoft.com/en-us/library/aa730869(v=vs.80).aspx
– Cetin Basoz
Nov 15 '18 at 17:38
1
The INI file format has massive amounts of appcompat associated with them. Reading a single setting from such a file takes 50 milliseconds on a spindle drive. That makes it unsuitable for use today. Use Project > Properties > Settings, press F1 to learn more.
– Hans Passant
Nov 17 '18 at 12:22