Serializable
과 같은 개체에 사용되는 일반적인 특성 어딘가에 목록이 있습니까?.NET 속성 목록
감사
편집 ~ 내가 물어 이유는 내가 ntiers의 ORMS에서의 StoredProcedure 속성을 건너 온 것입니다.
Serializable
과 같은 개체에 사용되는 일반적인 특성 어딘가에 목록이 있습니까?.NET 속성 목록
감사
편집 ~ 내가 물어 이유는 내가 ntiers의 ORMS에서의 StoredProcedure 속성을 건너 온 것입니다.
예,보세요. msdn은 당신을 덮었습니다. here을보십시오.
편집 :이 링크 만 대답을 빨려. 다음은 이름에 Attribute가있는 모든로드 가능 유형 (gac)에 대한 작업 추출기입니다.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
var process = new Process();
//your path may vary
process.StartInfo.FileName = @"C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\gacutil.exe";
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.UseShellExecute = false;
process.StartInfo.Arguments = "/l";
process.Start();
var consoleOutput = process.StandardOutput;
var assemblyList = new List<string>();
var startAdding = false;
while (consoleOutput.EndOfStream == false)
{
var line = consoleOutput.ReadLine();
if (line.IndexOf("The Global Assembly Cache contains the following assemblies", StringComparison.OrdinalIgnoreCase) >= 0)
{
startAdding = true;
continue;
}
if (startAdding == false)
{
continue;
}
//add any other filter conditions (framework version, etc)
if (line.IndexOf("System.", StringComparison.OrdinalIgnoreCase) < 0)
{
continue;
}
assemblyList.Add(line.Trim());
}
var collectedRecords = new List<string>();
var failedToLoad = new List<string>();
Console.WriteLine($"Found {assemblyList.Count} assemblies");
var currentItem = 1;
foreach (var gacAssemblyInfo in assemblyList)
{
Console.SetCursorPosition(0, 2);
Console.WriteLine($"On {currentItem} of {assemblyList.Count} ");
Console.SetCursorPosition(0, 3);
Console.WriteLine($"Loading {gacAssemblyInfo}");
currentItem++;
try
{
var asm = Assembly.Load(gacAssemblyInfo);
foreach (Type t in asm.GetTypes())
{
if (t.Name.EndsWith("Attribute", StringComparison.OrdinalIgnoreCase))
{
collectedRecords.Add($"{t.FullName} - {t.Assembly.FullName}");
}
}
}
catch (Exception ex)
{
failedToLoad.Add($"FAILED to load {gacAssemblyInfo} - {ex}");
Console.SetCursorPosition(1, 9);
Console.WriteLine($"Failure to load count: {failedToLoad.Count}");
Console.SetCursorPosition(4, 10);
Console.WriteLine($"Last Fail: {gacAssemblyInfo}");
}
}
var fileBase = System.IO.Path.GetRandomFileName();
var goodFile = $"{fileBase}_good.txt";
var failFile = $"{fileBase}_failedToLoad.txt";
System.IO.File.WriteAllLines(goodFile, collectedRecords);
System.IO.File.WriteAllLines(failFile, failedToLoad);
Console.SetCursorPosition(0, 15);
Console.WriteLine($"Matching types: {goodFile}");
Console.WriteLine($"Failures: {failFile}");
Console.WriteLine("Press ENTER to exit");
Console.ReadLine();
}
}
}
나는 전체 속성 목록을 모르지만 MSDN에서 Attribute를 검색하면 흥미로운 결과를 얻을 수 있습니다. 흥미로운 속성 유형의 네임 스페이스를 탐색 한 다음이를 사용하여 내가 무엇을 사용할 수 있는지 살펴 보려고합니다. 가장 효율적인 방법은 아닙니다.
System.Attribute에 대한 MSDN 항목의 맨 아래쪽에 목록이 있습니다.
사용자 지정 특성을보고있을 가능성이 있기 때문에 찾고있는 것을 찾을 수 없습니다.
또한, 당신은 당신의 자신의 속성을 만들 수 있습니다. 다른 사람의 코드를 통해 검색하는 경우 자신의 코드를 만들 때 혼동하기 쉽습니다.
당신은 mscorlib
어셈블리를 찾아 반사경을 사용하고, System.Attribute
아래 파생 유형을 노드를 확장 할 수 있습니다. Reflector에 현재로드 된 모든 어셈블리의 모든 속성을 표시합니다.
내가 본 것은 "객체에서 사용되는 속성은 무엇입니까?" - 게시물의 직렬화 가능 속성이 제거되었습니다. 나는 그가 nullables (?와 ??)에 관해 묻고 있었지만 – StingyJack
는 오해가 해결되면 정확한 정보를 가지고있는 덧글과 업데이트 된 대답을 삭제했다. –