我正在使用它log4net来创建日志,但它没有执行任何操作。
这里是app.config:
<?xml version="1.0" encoding="utf-8">
<configuration>
<configSection>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSection>
<log4net>
<appender name="WriteToFile" type="log4net.Appender.FileAppender">
<file value="log.txt" />
<layout ="log4net.Layout.SimpleLayout" />
</appender>
<root>
<level value="ALL" />
<appender-ref ref="WriteToFile"/>
</root>
</log4net>
</configuration>
Run Code Online (Sandbox Code Playgroud)
我有以下行AssemblyInfo.cs:
[assembly: log4net.Config.XmlConfigur(ConfigFile ="App.config", Watch= true)]
Run Code Online (Sandbox Code Playgroud)
这是写入文件的尝试:
private static readonly ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public void write()
{
log.Info("Some text here");
}
Run Code Online (Sandbox Code Playgroud)
以及以下行:
log4net.Config.XmlConfigurator.Configure();
Run Code Online (Sandbox Code Playgroud) 我想使用绑定和字符串格式作为工具提示,这是我尝试过的:
<TextBlock Text="{Binding Name}"
ToolTip="{Binding Path=Name, StringFormat='The name is: {0}{}'}"/>
Run Code Online (Sandbox Code Playgroud)
Name的值是:
戈兰
我期望看到的是:
名称是:戈兰
但所看到的是:
戈兰
我试图将两个按钮彼此相邻放置在xml上,我希望它们的大小都相同(距离屏幕宽度的一半)-这是我的xml:
<LinearLayout
android:layout_width="fill_parent"
android:orientation="horizontal"
android:id="@+id/linearLayout2"
android:layout_height="fill_parent"
android:gravity="bottom"
android:weightSum="2">
<Button
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/bAddDelete"
/>
<Button
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/bMainMenu"
/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
一切正常,但是当我在java中更改文本时,宽度也在变化,我如何使它们具有相同的大小?
谢谢
我有以下列举:
public enum KodEnum
{
[EnumType(EnumType = "Task")]
TaskTab,
[EnumType(EnumType = "Task")]
TaskReason,
[EnumType(EnumType = "Action")]
ActionTab,
[EnumType(EnumType = "Action")]
ActionReason
}
public class EnumTypeAttribute : Attribute
{
public string EnumType { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
我想获得具有“任务”的EnumType的所有枚举的列表。
我该怎么办?
我正在使用react,我找到了这个很棒的库,可以帮助你为名为classNames的组件定义css类.我也使用webpack css-loader将css导入到我的组件中,当尝试使用带导入css的classNames时,我收到语法错误.
这是我的例子:
import React from 'react';
import styles from './style.css';
import classNames from 'classnames';
export default class Menu extends React.Component {
render() {
let style = classNames({
styles.someClass: true
});
}
}
Run Code Online (Sandbox Code Playgroud)
我怎么能同时使用?
c# ×2
android ×1
attributes ×1
binding ×1
class-names ×1
css ×1
css-loader ×1
enums ×1
log4net ×1
logging ×1
reactjs ×1
tooltip ×1
wpf ×1
xml ×1