我正在尝试创建一个链接列表,看看我是否可以,而且我无法理解它.有没有人有一个使用C#非常简单的链接列表实现的例子?到目前为止,我发现的所有例子都过分夸大了.
阅读MSDN文档时,它总是让您知道类是否是线程安全的.我的问题是你如何设计一个线程安全的类?我不是在谈论用锁定调用类我意味着我正在为Microsoft创建XXX class\object而我想说它是"线程安全"我需要做什么?
我在我的启动中设置了以下代码
IDictionary<string, string> properties = new Dictionary<string, string>();
properties.Add("connection.driver_class", "NHibernate.Driver.SqlClientDriver");
properties.Add("dialect", "NHibernate.Dialect.MsSql2005Dialect");
properties.Add("proxyfactory.factory_class", "NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle");
properties.Add("connection.provider", "NHibernate.Connection.DriverConnectionProvider");
properties.Add("connection.connection_string", "Data Source=ZEUS;Initial Catalog=mydb;Persist Security Info=True;User ID=sa;Password=xxxxxxxx");
InPlaceConfigurationSource source = new InPlaceConfigurationSource();
source.Add(typeof(ActiveRecordBase), (IDictionary<string, string>) properties);
Assembly asm = Assembly.Load("Repository");
Castle.ActiveRecord.ActiveRecordStarter.Initialize(asm, source);
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
failed: NHibernate.Bytecode.UnableToLoadProxyFactoryFactoryException : Unable to load type 'NNHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle' during configuration of proxy factory class.
可能的原因是:
我已阅读并阅读我正在参考列出的所有大会,我完全不知道接下来要尝试什么.
Castle.ActiveRecord.dll
Castle.DynamicProxy2.dll
Iesi.Collections.dll
log4net.dll
NHibernate.dll
NHibernate.ByteCode.Castle.dll
Castle.Core.dll.
我100%确定装配在箱子里.有人有主意吗?
以下代码用作参与泛型的示例.
// type parameter T in angle brackets
public class GenericList<T>
{
// The nested class is also generic on T
private class Node
{
// T used in non-generic constructor
public Node(T t)
{
next = null;
data = t;
}
private Node next;
public Node Next
{
get { return next; }
set { next = value; }
}
// T as private member data type
private T data;
// T as return type of property …Run Code Online (Sandbox Code Playgroud) 简单的问题我想,我有点不确定为什么
decimal currentPercentage = 0;
currentPercentage = currentPercentage*((decimal)1 / (decimal)daysPerYear--);//or
currentPercentage *= ((decimal)1 / (decimal)daysPerYear--);
Run Code Online (Sandbox Code Playgroud)
每次都会返回0但是
(decimal)1 / (decimal)daysPerYear--;
Run Code Online (Sandbox Code Playgroud)
将返回我之后的小数.我在这里错过了什么?