블로그 이미지
Flying Mr.Cheon youGom

Recent Comment»

Recent Post»

Recent Trackback»

« 2025/12 »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31

 
 
 

복사해서 넣어둘까 했는데, 너무 길고, 깨지는게 많아서.. 이중에 쓸만한거 한두개만,,

JsonDocument를 사용하여 데이터 액세스

double sum = 0;
int count = 0;

using (JsonDocument document = JsonDocument.Parse(jsonString))
{
    JsonElement root = document.RootElement;
    JsonElement studentsElement = root.GetProperty("Students");
    foreach (JsonElement student in studentsElement.EnumerateArray())
    {
        if (student.TryGetProperty("Grade", out JsonElement gradeElement))
        {
            sum += gradeElement.GetDouble();
        }
        else
        {
            sum += 70;
        }
        count++;
    }
}

double average = sum / count;
Console.WriteLine($"Average grade : {average}");

 

개별 속성 이름 사용자 지정

public class WeatherForecastWithPropertyNameAttribute
{
    public DateTimeOffset Date { get; set; }
    public int TemperatureCelsius { get; set; }
    public string Summary { get; set; }
    [JsonPropertyName("Wind")]
    public int WindSpeed { get; set; }
}
{
  "Date": "2019-08-01T00:00:00-07:00",
  "TemperatureCelsius": 25,
  "Summary": "Hot",
  "Wind": 35
}

 

출처 : https://docs.microsoft.com/ko-kr/dotnet/standard/serialization/system-text-json-how-to

'클라이언트' 카테고리의 다른 글

카카오톡 전달하는 버튼이나 링크 만들기  (0) 2020.05.22
:

.NET PublicKeyToken

보안/리버싱 | 2020. 4. 24. 20:35 | Posted by youGom

c# 실행파일 하나 디컴파일 하다, 잘 안되길래 살펴보다 보니 publickeytoken 이라는 걸 활용하는 것 같아서 살펴봄.

어떻게 만들어지는지 참조해놓고, 이 걸 이용해서 풀어야 하는건지 살펴볼 예정,

 

--------------------------------------------------------------------

 

echo 'csharp code, bla bla bla' > main.cs

 

sn -k first.key

sn -p first.key first_pub.key

 

sn -tp first_pub.key

>> public key token ......

 

csc /keyfile:first.key /out:temp.dll /t:library main.cs

>> make temp.dll

 

ildasm /out:info.txt temp.dll

>> view info.txt

 

csc /r:temp.dll main.cs

>> make main.exe

 

ildasm /out:final.txt main.exe

>> view final.txt

 

--------------------------------------------------------------------

 

아래 영상은 검색하다 찾은 영상,

 

 

 

 

: