|
Hey All,
Just d/l your checkers game...http://www.codeproject.com/KB/game/DirectXBoardGameEngine.aspx[^]
However when I open it I am asked to convert it. When I try to build the game it says 'TypeLoadException was unhandled'
Method 'Initialize' in type 'Bornander.Games.Checkers.Direct3D.CheckersModelRepository' from assembly 'Bornander Games Checkers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.
Please advise?
Thanks in advance
|
|
|
|
|
You haven't downloaded my code here, you've downloaded Frederik Bornander's code from that article. Funnily enough, there's a forum at the bottom of the article (all the articles have forums) where you can ask THE ORIGINAL AUTHOR about their code. After all, they are the experts in their code and they are best placed to answer your questions.
|
|
|
|
|
|
MSDN wrote: The ?? operator is called the null-coalescing operator and is used to define a default value for a nullable value types as well as reference types. It returns the left-hand operand if it is not null; otherwise it returns the right operand.
|
|
|
|
|
Thanks.
|
|
|
|
|
The ?? is known as the null coalescing operator. That's a fancy dance way of saying that it tests to see if the left hand side is null, and if it is, it uses the right hand side. What this is doing, in your example, is evaluate items to see if it's null, and if it is, it assigns a new list to it and returns that. In practical terms, this is the same as doing this:
if (items == null)
items = new List<Item>();
return items I have missed the addition of the Item instances to the array to simplify this example, but you should get the idea from it.
[Edit]The OP deleted the original message. It was:
public class Item
{
public double X { get; set; }
public double Y { get; set; }
public string Name { get; set; }
public string Color { get; set; }
}
public class ItemsFactory
{
private List items;
public IEnumerable Items
{
get
{
return items ?? (items = new List<item>()
{
new Item { Name = "One", X = 33, Y = 25, Color = "Red" }, new
new Item { Name = "Two", X = 44, Y = 99, Color"Blue" }
});
}
}
}
modified 14-Nov-11 6:11am.
|
|
|
|
|
You put it much better than MSDN!
It’s not because things are difficult that we do not dare, it’s because we do not dare that things are difficult. ~Seneca
|
|
|
|
|
Thanks Annie. That's because, unlike MSDN, I'm trying to educate.
|
|
|
|
|
Thanks
|
|
|
|
|
Why did you delete your question? Don't do that.
"I love deadlines. I like the whooshing sound they make as they fly by." (DNA)
|
|
|
|
|
I have edited my answer to show what the OP asked.
|
|
|
|
|
Dear developers.
I developed a simple app that has a report viewer which connects to SQL server 2008.
i need to deploy the application to a terminal where all users can open it using a Shortcut to the exe trough Citrix.
My last app was in vb there where no problems there I just copied the exe file to the terminal and created the shortcut and everything worked fine.
Now I am using c# and the exe file trough an exception that the report viewer not found.
I tried the publishing it using ClickOnce and it is working.
The Q is can I only use the exe file and not publish the app? Because the shortcut targets only the exe file
Tanks,
Pniel
|
|
|
|
|
I would like to know if the following code is written ok or is there a better way? If there is a better way, can you explain and/or point me to a reference I can use? Is the linq writing from one datacontext object to some data fields ok? Also is the try catch adequate?
I do know the code works since I stepped through the code.
I am asking the question is this is my first time working with linq to sql in a C# 2010 application and I am the only programmer at my company.
<pre> protected void Ready_Data(Attes att, AtsDataContext attDataContext)
{
try {
var results = from s in attDataContext.Attes_Schedules
where s.Pay_Month == att.Pay_Month_Date
select new
{
PayDate = s.Pay_Month,
CurCStopDate = s.Current_C_Stop_Date,
PriorCStopDate = s.Prior_C_Stop_Date,
RptsReceviedMonth = s.Rpts_Rec_Month,
};
foreach (var r in results)
{
att.Pay_Month_Date = r.PayDate;
att.Current_C_Stop_Date = r.CurCStopDate;
att.Prior_C_Stop_Date = r.PriorCStopDate;
att.C_Rpts_Rec_Date = r.RptsReceviedMonth;
}
}
catch (Exception ex)
{
lblErrorMsg.Text = "Attes Page Processing problem";
lblErrorMsg.Visible = true;
hold_Exception = ex;
}
}</pre>
|
|
|
|
|
results is a collection you are integrating over yet att is a single object. That means if you have five items in results att will only be assigned the values in the last item when this method returns. If you only want/need a single item then use Single or SingleOrDefault method, or First or FirstOrDefault if that makes sense for you data
No comment
|
|
|
|
|
In this code I wanted to retreive the 5 items. I think this code returns all 5 items.
|
|
|
|
|
No it doesn't. You said you have stepped through the code. Didn't you notice the att object getting overwritten with new values each time? att is not a collection it is a single instance. Unless you have mistyped or not given complete information.
No comment
|
|
|
|
|
Just an FYI... you should not be writing LINQ2SQL code going forward as it has been COMPLETELY abandoned by Microsoft. They are now strictly on Entity Framework.
|
|
|
|
|
That's cool. Now I don't have to bother learning it!
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
|
The link you included says pretty much what I said! Linq2SQL is not getting any new features and is in "maintainence mode". That means *all* new dev effort is going into EF. I never said Microsoft was REMOVING Linq2SQL, I just said they abandoned it. Your very own Linq (no pun intended ) makes it pretty clear that Linq2SQL is pretty much "meh... if we find a serious bug in it thats a show stopper, we MAY fix it".
But whatever .
All I was telling the OP was that Microsoft isn't going to be doing anything with it going forward, so any new features are going to be strictly EF, so he shouldn't waste his time building his app around it.
|
|
|
|
|
There is quite difference between abandoned and maintenance. Abandoned means no further support which is not the case.
No comment
|
|
|
|
|
I think you are just arguing semantics at this point. If Microsoft tells you "we aren't going to be developing this any further", it is your choice to ignore them and continue down a dead end path.
|
|
|
|
|
Microsoft aren't adding extensions to + and -, either. That doesn't mean you shouldn't use them. Linq to SQL is part of the language and the Framework, and will remain so, and it's much nicer to use in certain circumstances than the equivalent code with DbAdapters and DataSets. It's absolutely fine to use it even if it's not getting extended in future (which is a big step away from 'completely abandoned').
EF is massive overkill for a lot of applications, particularly if you already have a database and can't use its magic wand to match everything up.
|
|
|
|
|
|
So I am attempting to achieve a zoom effect similar to Microsoft Office Word. When you change the zoom the entire document "zooms" in/out. The text area, the text itself, etc. I have actually done this before but it has been quite some time. So I cannot remember how to do it. And I cannot find anything on Google anywhere, perhaps I looked over it?
I think it had something to do with the Graphics class for the control and such. The setup is a Panel with a RichTextBox on it. Anyone else aware of how to do this? I just need a link or two that describe it.
djj55: Nice but may have a permission problem
Pete O'Hanlon: He has my permission to run it.
|
|
|
|