我有以下场景:
文章表
id | description | supplierID
_____________________________
1 | Testarticle | 1
Run Code Online (Sandbox Code Playgroud)
供应商表
id | description
_______________________
1 | Example Industries
Run Code Online (Sandbox Code Playgroud)
例如SELECT * FROM articles WHERE ID=1,在阅读文章时,
我还需要在结果中提供供应商描述.
什么是实现这一目标的适当方法?
我有一个方法,删除字符串上的描述字,但我相信有更有效的方法来做到这一点.
该iMonster可以像脂肪兽人盗贼,和我想删除的脂肪.
private static string[] _adjectives = { "angry",
"big",
"fat",
"happy",
"large",
"nasty",
"fierce",
"thin",
"small",
"tall",
"short" };
private static string RemoveMonsterAdjective(string iMonster)
{
foreach (string adjective in _adjectives)
{
if (iMonster.Contains(adjective))
{
iMonster = iMonster.Replace(adjective, "").Trim();
break;
}
}
return iMonster;
}
Run Code Online (Sandbox Code Playgroud)
希望有人可以帮助我.提前致谢.
在.NET中,假设thread A锁定一个对象.同时,thread B与thread C被阻塞并等待对象由被解锁thread A.
现在,thread A解锁了对象.接下来会选择哪个线程(B或C)?怎么决定?
我无法设法从textboxes运行时创建的值.
我希望用户从a中选择一些内容checkedlistbox,并textboxes在每次单击按钮时输入他想要的任何值.
我怎么能得到那些名字texboxes?他们真的存在吗?我是初学者,我真的不明白它们是如何创建的.
这是我创建的代码textboxes.
private void checkedListBox1_SelectedIndexChanged(object sender, EventArgs e)
{
int x = 466;
int y = 84;
foreach (var itemChecked in checkedListBox1.CheckedItems)
{
int i = 0;
TextBox tb = new TextBox();
tb.Location = new Point(x, y);
tb.Name = "txtBox" + i++.ToString();
Controls.Add(tb);
y += 30;
}
Run Code Online (Sandbox Code Playgroud) int i;
int[] mArray = new int[5];
for (i = 0; i < mArray.Length; i++)
{
Console.WriteLine("Please enter a number:");
mArray[i] = Convert.ToInt32(Console.ReadLine());
if (mArray[i] >= 50 && mArray[i] <= 10)
{
Console.WriteLine("Please enter numbers only between 10 and 50.");
mArray[i] = Convert.ToInt32(Console.ReadLine());
}
}
Run Code Online (Sandbox Code Playgroud)
当它有两个规则时,似乎无法获得if语句 if (mArray[i] >= 50 && mArray[i] <= 10)
但它适用于1规则 if (mArray[i] >= 50)
我有一段代码:
IList<Opportunity> filteredOpportunityProperties = new List<Opportunity>();
List<LookupWithIntId> selectedProperties = opportunityFilter.PropertyTypes;
List<string> propertyTypes = selectedProperties.Select(item => item.Name).ToList();
opportunities.Where((item) =>
{
string productType = item.Properties[0].ProductType;
bool propertyMatch = propertyTypes.Any(propTypes => productType.Contains(propTypes));
if (propertyMatch) select item;
});
Run Code Online (Sandbox Code Playgroud)
如果条件匹配,我想要选择该项.但是,我收到错误:
嵌入式语句不能是声明或带标签的语句
有什么建议!
我有以下日期时间:
Start = 15/12/2012 13:00:00
End = 16/02/2013 14:00:00
Run Code Online (Sandbox Code Playgroud)
我怎样才能将它分成3个部分?
- 15-12-2012 13:00:00 -> 01-01-2013 00:00:00
- 01-01-2013 00:00:00 -> 01-02-2013 00:00:00
- 01-02-2013 00:00:00 -> 16-02-2013 14:00:00
Run Code Online (Sandbox Code Playgroud)
总时间跨度必须保持不变.LINQ可以轻松完成吗?
我正在使用C#中的日期,需要计算更多日期.拿走当前datetime.
如何获得以下值?
NSUrlConnection和之间有什么区别NSMutableUrlConnection?
如何检查是否array2是子集array1?换句话说,我要检查的所有元素是否array2存在于array1或不?我想要解决方案Lambda或Linq.
int[] array1 = {6, 3, 1, 4, 5, 2};
int[] array2 = {1, 2, 3};
Run Code Online (Sandbox Code Playgroud) 我在c#中看到过这种代码:
private int id {get;set;}
Run Code Online (Sandbox Code Playgroud)
但我只会为该字段创建getter,如果有get和set,则与public字段相同,唯一的方法是:
public int getId(){return id;}
Run Code Online (Sandbox Code Playgroud)
如何在VS2010中自动生成getter
如果用户检查Checkbox,我如何编码显示MessageBox.Show("...",使用YesNoCancel消息框中的按钮,当用户单击否时,另一个MessageBox.Show弹出?
到目前为止我的代码是这样的,它不起作用:
private void lipsCheckBox_CheckedChanged(object sender, EventArgs e)
{
if (lipsCheckBox.Checked = MessageBox.Show("...?",
"Want something else?",
MessageBoxButtons.YesNoCancel, MessageBox.Show("...?",
"Yea, Burt's bees?",
MessageBoxButtons.YesNoCancel, MessageBox.Show("...??",
"Hell yea LipxMedx?",
MessageBoxButtons.YesNoCancel),
MessageBoxIcon.Question);
}
Run Code Online (Sandbox Code Playgroud)