我愿储存一个尺寸的阵列,作为我的<编码>应用程序代码>的条目。 我只能用<代码>、或>>>/>>代码分别列出内容,因为内容本身可以包含这些特性。
我正在考虑将阵列作为<代码>JSON/code>加以储存,然后使用<代码>将其降级。 JavacastSerializer。
是否有“权利”/如何做到这一点?
(My JSON
思想感觉到美容
我愿储存一个尺寸的阵列,作为我的<编码>应用程序代码>的条目。 我只能用<代码>、或>>>/>>代码分别列出内容,因为内容本身可以包含这些特性。
我正在考虑将阵列作为<代码>JSON/code>加以储存,然后使用<代码>将其降级。 JavacastSerializer。
是否有“权利”/如何做到这一点?
(My JSON
思想感觉到美容
You could use the AppSettings with a System.Collections.Specialized.StringCollection
.
var myStringCollection = Properties.Settings.Default.MyCollection;
foreach (String value in myStringCollection)
{
// do something
}
每个数值按新线分列。
这里有一张屏幕(Ggerman IDE,但可能有用)
ASP. 核心网支持它约束一份显示器或物体清单。
如上文所述,可在<条码>中检索。
或者通过<代码>Get<、List<、MyObject>(>的物体清单。 样本如下。
appdings.json
:
{
...
"my_section": {
"objs": [
{
"id": "2",
"name": "Object 1"
},
{
"id": "2",
"name": "Object 2"
}
]
}
...
}
代表物体的类别
public class MyObject
{
public string Id { get; set; }
public string Name { get; set; }
}
《从<代码>上检索的代码》
Configuration.GetSection("my_section:objs").Get<List<MyObject>>();
对于ger,我发现以下方式较快。
首先,在您的评议中,用mas子分离出的惯性价值观,形成了一种关键特征。
<add key="myIntArray" value="1,2,3,4" />
然后,通过使用LINQ,将价值分成并转换成暗阵。
int[] myIntArray = ConfigurationManager.AppSettings["myIntArray"].Split( , ).Select(n => Convert.ToInt32(n)).ToArray();
插图很容易,只需在web.config
上添加以下内容。 档案:
<add key="myStringArray" value="fred,Jim,Alan" />
之后,你可将价值检索到如下阵列:
var myArray = ConfigurationManager.AppSettings["myStringArray"].Split( , );
You may also consider using custom configuration section/Collection for this purpose. Here is a sample:
<configSections>
<section name="configSection" type="YourApp.ConfigSection, YourApp"/>
</configSections>
<configSection xmlns="urn:YourApp">
<stringItems>
<item value="String Value"/>
</stringItems>
</configSection>
也可以检查这一优良的Visualroom Add-in,使你能够进行制图。 NET 配置科,并自动生成所需的所有代码和图形定义。
这可能是你寻求的:
A. 储存主要NLongerMain 和一系列座标
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
"NoLongerMaintained": ["BCD",
"DDP",
"DHF",
"DHW",
"DSG",
"DTH",
"SCH"]
}
然后,你可以检索它,作为阵列。
var NoLongerMaintained = _config.GetSection("NoLongerMaintained").Get<string[]>();
In my webpages I have references to js and images as such: "../../Content/Images/"Filename" In my code if I reference a file as above, it doesnt work so i have to write: "c:/miscfiles/"filename" 1-...
I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...
Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...
I m looking for best practices here. Sorry. I know it s subjective, but there are a lot of smart people here, so there ought to be some "very good" ways of doing this. I have a custom object called ...
I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...
i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...
For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?
I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!