Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
Is there a way to ensure that other .NET languages will interoperate with my C# classes ?
The most important thing would be for you to use the CLSCompliantAttribute. This prevents you from inadvertently using non CLS compliant features in C#.
There are a few pretty obvious rules that I can mention here. Note, this list is not exhaustive. I just wanted to point our some of the rules to give you a feel of what CLS compliance is all about.
Do not use unsafe types (pointers) in the public interface.
Do not mix member name casing in the public interface.
Do not use unsigned types in the public interface.
Read the article Cross Language Interoperability for more information.
Yes, decorate your assembly with CLSCompliant attribute.
Making your code CLS Compliant
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I have read the other topics but there is apparently no way to do it,
is it possible to use C code in C# Project without using dll ?
It depends on how you are defining "use" and "C code" but the basic answer is No. You certainly can't just include a C header file or call native C functions.
You can however write code that looks like C in C# (still using pointers and such), you just need to be in unsafe mode. Note that any C standard methods would not be available and some syntactic changes would be necessary if you were pasting in C source. This is also considered bad practice; you should be writing in normal C# 99.99999% of the time.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Is there any algorithm for Encrypt and Decrypt String values not exactly in .net ? I don't want to use .net libraries... like RijndaelManaged or something like this.
can u suggest me useful algorithm that implements in C# language?
An encryption algorithm is just a mathematical rule for changing a bunch of data into something else in order to hide it. It it not dependent on any specific programming language, just as calculating the area of a rectangle is not dependent on language - it can be done in many different languages, and should give the same result regardless.
You might want to browse some of the questions tagged with "encryption" in the Information Security site. That should give you a good idea about how this stuff works and is used for different situations.
To answer your question: You probably want to find some generic algorithm that is supported in several languages. The RSA algorithm may be what you need, and it is supported in C# / .Net by using the RSACryptoServiceProvider class.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
Let's say I own a domain called www.john-doe.com. How would I write an appropriate namespace in C#?
Is it Com.John_Doe.<product-name> ?
All I read about C# namespace convetions is that it should use PascalCase. But what about the minus sign? Is it appropriate to write an underscore for it?
According to .NET namespace conventions, you should use pascal casing in namespaces (unless that goes against non-standard casing your company/brand/product uses). And according to capitalization conventions, pascal casing should not include underscores. General naming conventions also tell you to not use hyphen (which will actually produce compiler errors in C# anyway).
Unless Com is intended to be replaced with your company name (from the context, "John Doe" sounds like the company) You should just go with:
JohnDoe.<ProductName>
I think it is personal preference. E.g. my preference is JohnDoe.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Both C# and java implement generics covariance and contravariance, but in a quite different manner: C# restricts co- and contra-variance to generics interfaces, Java enables it to any generics class or method.
What are exactly the differences regarding to the syntax?
What kind of code is possible in one language that is not possible in the other language?
What are the practical limitations due to the lack of integration in their respective framework (i.e. missing implementation of default collection)?
Thank you in advance!
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I recently start to learn C# and I want to know whether the C# is Pure Object-Oriented with reason in both the cases(cases yes or no).
I'm not %100 sure exactly the meaning of "pure" object-oriented but my answer is YES.
From Smaltalks wikipedia page;
Smalltalk is a "pure" object-oriented programming language, meaning
that, unlike Java and C++, there is no difference between values which
are objects and values which are primitive types. In Smalltalk,
primitive values such as integers, booleans and characters are also
objects,
That is the same as in C#.
I found an interesting article called Wyvern: A Simple, Typed, and Pure Object-Oriented Language
1.1 What Makes an Object-Oriented Model Pure?
From these sources, we extract three key requirements that we wish to
satisfy in coming up with a typed, pure object-oriented model:
Uniform access principle. Following Meyer, Cook, and Kay, it should be possible to access objects only by invoking their methods.
Interoperability and uniform treatment. Different implementations of the same object oriented interface should interoperate by default,
and it should be easy to treat them uniformly at run time (e.g., by
storing different implementations of the same interface within a
single run-time data structure).
State encapsulation. All mutable state should be encapsulated within objects.