我有两个不同对象的两个不同列表。然后我得到一个viewmodel列表,其中包含来自两个对象的属性,我希望它们被加入到该列表中。
NAME="myapp"
SCPROXY_INSTALLATION_DIR="/opt/local/bin"
# Script identifier (same as package identifier).
IDENTIFIER="com.mycomp.myapp"
LAUNCH_AGENT_PLIST="/Library/LaunchAgents/$IDENTIFIER.plist"
# Write LaunchDaemon plist file.
echo '<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>'$IDENTIFIER'</string>
<key>ProgramArguments</key>
<array>
<string>'$SCPROXY_INSTALLATION_DIR/$NAME'</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>StandardOutPath</key>
<string>/var/log/scproxy.log</string>
<key>StandardErrorPath</key>
<string>/var/log/scproxy.log</string>
<key>Debug</key>
<true/>
</dict>
</plist>' > "$LAUNCH_AGENT_PLIST"
/bin/launchctl unload $LAUNCH_AGENT_PLIST
/bin/launchctl load $LAUNCH_AGENT_PLIST
#exit 0
# Check LaunchDaemon is loaded.
STATUS=`/bin/launchctl list | /usr/bin/grep $IDENTIFIER | /usr/bin/awk '{print $3}'`
if [ "$STATUS" = "$IDENTIFIER" ]
then
echo "Success: LaunchAgent loaded."
exit 0
else
echo "Error: LaunchAgent not loaded."
exit 1
fi
所以我只想将产品列表和productdescriptions列表加入productResponse列表中。我怎样才能做到这一点?产品和产品描述的ID是相同的,所以我想加入它们。
答案 0 :(得分:2)
将他们加入ID,然后致电ToList
:
var productResponses = from p in products
join pd in productDescriptions
on p.id equals pd.id
select new ProductResponse
{
id = p.id,
language = pd.language,
// ...
}
var list = productResponses.ToList();