Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean code use lambda instead of foreach. #144

Merged
merged 4 commits into from
Apr 3, 2021

Conversation

isdaniel
Copy link
Member

@isdaniel isdaniel commented Apr 3, 2021

Hi 緯翰大

這次PR我有以下調整

  1. use lambda instead of foreach.
  2. Write Reflection extension

另外我有看到 你有開一個ticket

#142

請問一下你想要做的事情是使用ColumnIndex指定哪一列 要放哪個Property Value嗎?

@shps951023
Copy link
Member

shps951023 commented Apr 3, 2021

@isdaniel 感謝石頭大!

另外會想另外建立一個 ExcelColumnIndexAttribute
差別在:
額外建立版本

public class Demo
{
	[ExcelColumnIndex("A")] // equal column index 0
	public int MyProperty { get; set; }
	[ExcelColumnIndex(1)]
	public int MyProperty { get; set; }
}

內含在 ExcelColumnName with ColumnIndex 版本

public class Demo
{
	[ExcelColumnIndex(columnIndex:"A")] // equal column index 0
	public int MyProperty { get; set; }
	[ExcelColumnName(columnIndex:2)]
	public int MyProperty2 { get; set; }
}

image

@shps951023
Copy link
Member

請問一下你想要做的事情是使用ColumnIndex指定哪一列 要放哪個Proeprty Value嗎?

是,跟 Query 時指定 proeprty 讀取的欄位順序
目前遇到的困難在於 一些使用Index Attribue,一些不用情況
像是

public class Demo
{
	public int MyProperty { get; set; }  //index = 1
	
	public int MyProperty2 { get; set; } //index = 3
	public int MyProperty3 { get; set; } //index = 4
	[ExcelColumnIndex(columnIndex:"A")] // equal column index 0
	public int MyProperty4 { get; set; }
	[ExcelColumnName(columnIndex:2)]
	public int MyProperty5 { get; set; } //index = 2
	public int MyProperty3 { get; set; } //index = 5
}

但還在考慮這個功能實不實用,自己沒用過這功能,但其他框架有提供才列在Issue

Copy link
Member

@shps951023 shps951023 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Member

@shps951023 shps951023 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

先暫時刪除 ExcelColumnIndex 先,後面會實作

@shps951023 shps951023 merged commit 81c204d into mini-software:master Apr 3, 2021
@isdaniel
Copy link
Member Author

isdaniel commented Apr 3, 2021

我了解了
沒問題你先刪掉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants