禁用警告的语法如下:
#pragma warning disable 414, 3021
Run Code Online (Sandbox Code Playgroud)
或者,更一般地表达:
#pragma warning disable [CSV list of numeric codes]
Run Code Online (Sandbox Code Playgroud)
是否有这些数字代码的列表以及它们要抑制的警告的描述?令我懊恼的是,我似乎无法通过谷歌找到它.
如果有的话,在常规JOIN上显式执行HASH JOIN有哪些优点(其中SQL Server将决定最佳的JOIN策略)?例如:
select pd.*
from profiledata pd
inner hash join profiledatavalue val on val.profiledataid=pd.id
Run Code Online (Sandbox Code Playgroud)
在上面简单的示例代码中,我指定了JOIN策略,而如果我省略"hash"关键字,SQL Server将在幕后进行MERGE JOIN(根据"实际执行计划").
我的应用程序需要阻止睡眠/休眠模式.我已经有了代码,但在成功捕获WM_POWERBROADCAST消息后,PBT_APMQUERYSUSPEND和PBT_APMQUERYSTANDBY都未成功捕获.有趣的是,PBT_APMRESUMECRITICAL和PBT_APMRESUMEAUTOMATIC消息都被我的应用程序捕获.
底线问题:我的应用程序无法捕获备用/暂停消息,但成功捕获恢复消息是否有任何原因?
这个Q&A [stackoverflow.com]有帮助,顺便说一下,但是这些消息似乎没有进入我的应用程序.
我的代码(为了简洁起见删除了事件日志代码):
protected override void WndProc(ref System.Windows.Forms.Message m)
{
// Power status event triggered
if (m.Msg == (int)NativeMethods.WindowMessage.WM_POWERBROADCAST)
{
// Machine is trying to enter suspended state
if (m.WParam.ToInt32() == (int)NativeMethods.WindowMessage.PBT_APMQUERYSUSPEND ||
m.WParam.ToInt32() == (int)NativeMethods.WindowMessage.PBT_APMQUERYSTANDBY)
{
// Have perms to deny this message?
if((m.LParam.ToInt32() & 0x1) != 0)
{
// If so, deny broadcast message
m.Result = new IntPtr((int)NativeMethods.WindowMessage.BROADCAST_QUERY_DENY);
}
}
return; // ?! …Run Code Online (Sandbox Code Playgroud) 给定一个XSD文件,如下所示的代码会在返回的DataSet中的两个DataTable中生成一个额外(和不需要的)列.
ds.ReadXmlSchema(s);
Run Code Online (Sandbox Code Playgroud)
两个DataTable都有一个Order_Id列; 其他列与XSD完美匹配.
有没有人见过这个?
XSD文件如下:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="Order">
<xs:complexType>
<xs:sequence>
<xs:element name="Item" minOccurs="0" maxOccurs="unbounded">
<xs:complexType msdata:AutoIncrement="false">
<xs:attribute name="itemId" type="xs:unsignedInt" />
<xs:attribute name="stockCode" type="xs:string" />
<xs:attribute name="stockCodeType" type="xs:string" />
<xs:attribute name="Quantity" type="xs:unsignedLong" />
<xs:attribute name="ProductIdX" type="xs:unsignedInt" />
<xs:attribute name="legalEntity" type="xs:string" />
<xs:attribute name="countryOfIssue" type="xs:string" />
<xs:attribute name="branchSystem" type="xs:string" />
<xs:attribute name="accountId" type="xs:string" />
<xs:attribute name="settlementDate" type="xs:string" />
<xs:attribute name="tradeDate" type="xs:string" />
<xs:attribute name="partyCode" type="xs:string" />
<xs:attribute name="userId" type="xs:string" />
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="OrderId" type="xs:unsignedInt" …Run Code Online (Sandbox Code Playgroud) 在C#中,通常有这样的方法:
public IPerson GetPerson()
{
// do stuff
return new Person(..);
}
Run Code Online (Sandbox Code Playgroud)
其中," IPerson"是用于通过一个接口Person,SpecialPerson等等.在换句话说,尽管上面的方法返回Person,一个策略模式可以被实现为使得一个SpecialPerson被代替返回的Person,条件是它们都使用IPerson的接口.
这种事情在Java中是否可行?
c# ×4
dataset ×1
interface ×1
java ×1
join ×1
join-hints ×1
pragma ×1
sleep-mode ×1
sql-server ×1
t-sql ×1
xml ×1
xsd ×1