Created
August 7, 2023 07:05
-
-
Save vibs2006/7fc2695da28bf082617d38603ac63140 to your computer and use it in GitHub Desktop.
C# Small codes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Get Nullable Type | |
namespace TestConsoleApp | |
{ | |
public class PaginationRequestParams | |
{ | |
public string? page_cursor { get; set; } | |
public int? count { get; set; } | |
public string? response_fields { get; set; } | |
public DateTime? created_to { get; set; } | |
public DateTime? created_from { get; set; } | |
public DateTime? modified_to { get; set; } | |
public DateTime? modified_from { get; set; } | |
public string? customer_id { get; set; } | |
public string? StoreKey { get; set; } | |
} | |
} | |
Console.WriteLine("Hello, World!"); | |
Type type = typeof(PaginationRequestParams); | |
PropertyInfo[] properties = type.GetProperties(); | |
foreach (PropertyInfo property in properties) | |
{ | |
Console.WriteLine("********************************************************"); | |
if (property.PropertyType.Name.ToLower().Contains("null")) | |
{ | |
var aa = Nullable.GetUnderlyingType(property.PropertyType); | |
Console.WriteLine(aa); | |
} | |
else | |
{ | |
Console.WriteLine($"{property.PropertyType.Name}"); | |
} | |
//Console.WriteLine(JsonConvert.SerializeObject(property, Formatting.Indented)); | |
Console.WriteLine("********************************************************"); | |
} | |
Console.WriteLine("Completed..."); | |
Console.ReadLine(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment